如何防止flycheck将我的init.el视为软件包文件?


17

如果为我的init.el启用flycheck-mode,则出现以下几种错误:

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)

如何停止flycheck将我的init.el视为软件包?

编辑

我试图遵循以下最小启动文件:

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

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

仅启用flycheck及其依赖项。emacs-lisp-checkdoc在禁用的检查器列表中,但flycheck仍列出错误:

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)

我正在git存储库(26snapshot)中使用Emacs 24.5.1和最新的flycheck。

Answers:


14

添加emacs-lisp-checkdocflycheck-disabled-checkers

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

它对我不起作用...相同的错误。
xuhdev '16

@xuhdev在Emacs Lisp缓冲区中Ch v flycheck-disabled-checkers的结果是什么?
lunaryorn '16

“ flycheck-disabled-checker的值为(emacs-lisp-checkdoc)”
xuhdev

4
这将完全禁用emacs-lisp检查器,对吗?检查程序有很多有用的功能,但示例中的功能不是其中之一。如果有一种方法可以得到良好的flycheck错误而又没有不需要的错误,那将是很好的。
zck

1
@zck不幸的是,没有任何人。checkdoc没有提供允许您禁用特定警告的复杂警告控件。您最多可以编写一个自定义的flycheck-process-error(或者,不记得它的名字)函数来禁止突出显示这些错误,但是它们始终会出现在错误列表中。
lunaryorn '16

2

这是检查器实际期望的格式:

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

如果将其放在init.el的顶部,它将删除警告。

您可以进入菜单并选择Emacs-Lisp-> Check Documentation Strings并填写所需的字段,以使emacs自动为您插入此文件。资料来源:https : //github.com/purcell/emacs.d/issues/152


1
或者M-x checkdoc
君特Zöchbauer
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.