1

When flycheck runs when I am editing largish XML files (I believe it is just nxml mode), it tends to slow things to a crawl and then I have to kill emacs since C-g only works for a fraction of second. If I get the chance to turn flycheck-mode off after I open the file everything is fine.

How do I disable it while keeping the global flycheck mode on?


These answers are close but I don't know what to fill in for the latex stuff, nor were the instructions for figuring this out helpful:

Disable Minor Mode in Major Mode

Disable flycheck for laTeX

salotz
  • 1,370
  • 10
  • 21

1 Answers1

1

You can add the xml checkers to flycheck-disabled-checkers. For instance, if you are using use-package in your init file:

(use-package flycheck
  :ensure t
  :config (global-flycheck-mode)
  (with-eval-after-load 'flycheck
    (setq-default flycheck-disabled-checkers '(xml-xmlstarlet xml-xmllint))))

will enable flycheck globally, but disable the (two default) xml checkers.

Alternatively, you could disable flycheck itself in *.xml files with:

(add-to-list 'auto-mode-alist '("*\\.xml\\'" . (lambda () (flycheck-mode -1) (xml-mode))))

Or, you could add a hook to xml-mode (which is just an alias of nxml-mode in modern Emacs)

(add-hook 'nxml-mode-hook  (lambda () (flycheck-mode -1)))

I personally use use-package and therefore the first method. Adding a hook to nxml-mode-hook would be the way to go otherwise. (Ab)Using auto-mode-alist for this is rather brutish, and probably frowned upon as bad style.

nega
  • 3,091
  • 15
  • 21
  • This wasn't working for me and I am trying to see if there is just something wrong with my config somewhere else before I accept – salotz Aug 12 '19 at 23:18