19

If flycheck-mode is enabled for my init.el, I got the following kinds of errors:

The first line should be of the form: ";;; package --- Summary" (emacs-lisp-checkdoc)
...
The footer should be: (provide 'init)\n;;; init.el ends here (emacs-lisp-checkdoc)

How can I stop flycheck from treating my init.el as a package?

EDIT

I tried to following minimal start up file:

;; flycheck-mode
(require 'flycheck)
(global-flycheck-mode)

(setq-default flycheck-disabled-checker '(emacs-lisp-checkdoc))

Only flycheck and its dependencies are enabled. emacs-lisp-checkdoc is in the disabled checker list but flycheck still lists errors:

0     warning         The first line should be of the form: ";;; package --- Summary" (emacs-lisp-checkdoc)
0     warning         You should have a section marked ";;; Commentary:" (emacs-lisp-checkdoc)
2   1 error           Cannot open load file: no such file or directory, flycheck (emacs-lisp)
3     warning         You should have a section marked ";;; Code:" (emacs-lisp-checkdoc)
5     warning         The footer should be: (provide 'test)\n;;; test.el ends here (emacs-lisp-checkdoc)

I'm using Emacs 24.5.1 and the latest flycheck in the git repository (26snapshot).

14

Add emacs-lisp-checkdoc to flycheck-disabled-checkers:

(setq-default flycheck-disabled-checkers '(emacs-lisp-checkdoc))
| improve this answer | |
  • It doesn't work for me... same errors. – xuhdev Apr 17 '16 at 19:03
  • @xuhdev What's the result of C-h v flycheck-disabled-checkers in an Emacs Lisp buffer? – user227 Apr 17 '16 at 19:19
  • "flycheck-disabled-checker's value is (emacs-lisp-checkdoc)" – xuhdev Apr 17 '16 at 20:10
  • 4
    This will disable the emacs-lisp checker entirely, right? There are a lot of useful things the checker does, but the one in the example is not one of them. It would be nice if there was a way to get the good flycheck errors without the unwanted ones. – zck Apr 18 '16 at 3:38
  • 1
    @zck There is none, unfortunately. checkdoc does not provide sophisticated warning control that lets you disable specific warnings. You can at best write a custom flycheck-process-error (or so, don't remember the name) function to suppress highlighting of these errors, but they'll always appear in the error list. – user227 Apr 18 '16 at 7:09
5

Here's the format that the checker is actually expecting:

;;; init.el --- Initialization file for Emacs
;;; Commentary: Emacs Startup File --- initialization for Emacs

If you place this at the top of your init.el it'll remove the warning.

You can get emacs to insert this for you automatically by going to the menu and selecting Emacs-Lisp->Check Documentation Strings and fill in the requested fields. Source: https://github.com/purcell/emacs.d/issues/152

| improve this answer | |

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.