So my question is like in title. I want to turn off flycheck minor mode for all files in directory. I have specified in my .emacs file that it should be on in c++-mode, c-mode and few others, but I don't want this rule to apply to one given directory.
Preferably I'd like to turn it off using .dir-locals.el file. My knowledge of lisp code is very limited and since specyfying (remove-hook 'c++-mode-hook 'flycheck-mode) hasn't done anything, I don't really know what should I do to get the effect I want.


Well you wouldn't want to remove the hook, as that's a global effect.

You can disable the mode on a per-buffer basis, though. Use the eval pseudo-variable. e.g. a .dir-locals.el like this would act for any/all major modes:

((nil . ((eval . (flycheck-mode 0)))))

Local variables are processed after mode hooks, so this should reliably counteract your existing code (n.b. I've not tested this).

  • 1
    Sadly this didn't do a trick for me. I found partial solution though with ((c++-mode (flycheck-disabled-checkers c/c++-clang c/c++-gcc))) so that will do for now. – dotPoozer Feb 16 '16 at 2:08
  • Curious. I don't use flycheck, but I just tested my approach with linum-mode, and it works as expected for me (in Emacs 24.5). Perhaps flycheck-mode is non-standard in how you disable it? (although that seems unlikely). – phils Feb 16 '16 at 2:24
  • Now tested with flycheck too, which is also working as expected with your hook and my .dir-locals.el file. – phils Feb 16 '16 at 2:27
  • When I put your code, and only your code, it worked, so I'm guessing it's because I don't really understand how elisp works and rest of my code was causing the problems. I was putting it like this, ((c++-mode (irony-additional-clang-options "libs") (company-clang-arguments "libs"))) ((nil . ((eval . (flycheck-mode 0))))) – dotPoozer Feb 16 '16 at 2:28
  • And it's working. I'm really not sure what was malfunctioning. And why. All I can say is thank you for helping ;] – dotPoozer Feb 16 '16 at 2:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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