0

This question already has an answer here:

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

marked as duplicate by Drew, DoMiNeLa10 Aug 8 at 21:11

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

0

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.

  • 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 at 23:18

Not the answer you're looking for? Browse other questions tagged or ask your own question.