8

I use flycheck with flycheck-elisp-checkdoc checker active and find them fairly useful.

Still, I find it irritating to be nagged about missing (provide), section headers (;;; Code, ...), package metadata and similar things while I am editing my ~/emacs/etc (that's ~/.emacs split into smaller pieces). Those files are short configuration snippets and adding those comments would only make them longer and less readable.

So, what is the best way to disable those warnings in this very place (but only there, the same reminders are very useful once I edit my true lisp modules...)?

I do not really mind whether it would mean disabling flycheck-elisp-checkdoc checker for flycheck in this very dir, or reconfiguring checkdoc in this ery place, or something in-between – although the latter case would also handle other ways of spawning checkdoc…

Dan
  • 32,584
  • 6
  • 98
  • 168
Mekk
  • 1,017
  • 7
  • 14

1 Answers1

9

Set flycheck-disabled-checkers to (emacs-lisp-checkdoc) via file or directory variables, i.e. M-x add-file-local-variable RET flycheck-disabled-checkers RET (emacs-lisp-checkdoc) or add-dir-local-variable RET emacs-lisp-mode RET flycheck-disabled-checkers RET (emacs-lisp-checkdoc) respectively.

See Syntax checkers in the Flycheck manual for more information.

Iain
  • 194
  • 10
  • Thank you, it works. I knew about ```flycheck-disabled-checkers``` but forgot that it can be set via dir-locals. – Mekk Apr 22 '15 at 14:52
  • (still curious whether sth similar can be configured also for ```M-x checkdoc```, but that's not that important) – Mekk Apr 22 '15 at 14:54
  • Turns out there is minor annoyance in this solution. Whenever I start emacs, I get warning ```Warning (emacs): Failed to load file /home/marcink/DEV_hg/emacs/etc/.dir-locals.el: (invalid-function (emacs-lisp-mode (flycheck-disabled-checkers emacs-lisp-checkdoc))) ``` (flycheck is loaded by one of those etc files, but looks like .dir-locals is interpreted when they are processed). – Mekk Apr 25 '15 at 06:47
  • This is an issue in your configuration. Neither Emacs nor Flycheck load dir locals. You probably have some code in your init file which loads all files in etc/. –  Apr 25 '15 at 08:04
  • 1
    Of course I have such code, that's the point of using this dir... Ahh, you mean my code reads .dir-locals.el too? Will take a look – Mekk Apr 25 '15 at 12:03
  • 1
    Yes, good point, my loop iterated over any .el files in etc directory, so catched .dir-locals.el too. Thank you for hint. – Mekk Apr 28 '15 at 09:53
  • If you wish to put this in your `init.el` simply add: `(setq-default flycheck-disabled-checkers '(emacs-lisp-checkdoc))`. – Winny Nov 04 '21 at 23:49