2

我在 Emacs 中使用 flymake 来检查用多种语言编写的代码。但是,我看不到在 elisp 本身上使用 flymake 的任何方法。

我知道elint-current-buffer, 和byte-compile-file,它们都对未定义的变量等给出有用的警告。奇怪的是,它们并不总是给出相同的错误:例如,elint 不会对(require 'cl). 我也尝试过auto-compile-mode(在 MELPA 上可用),但这仍然会将警告写入单独的缓冲区。

当我输入错误时,我真的希望我的 elisp 代码有下划线。我该怎么做呢?我之前配置过flymake,但那是使用外部程序,而不是Emacs 本身。

4

3 回答 3

5

Emacs wiki 对 emacs lisp 的 flymake 有这样的说法,尽管它看起来并不完整。

不过, flycheck支持 Emacs Lisp “开箱即用”。

于 2013-04-02T14:42:22.640 回答
1

Erefactor 相当不错,可从 wiki 和 melpa 获得: http ://www.emacswiki.org/emacs/erefactor.el

我也喜欢在保存后运行 checkdoc:

 (defun emagician/run-checkdoc () 
   "run checkdoc on save if it is an elisp file"
   (if (and (eq major-mode 'emacs-lisp-mode)
            (> (length buffer-file-name)
               (length package-user-dir))
            (not (string= (concat package-user-dir "/")
                          (substring buffer-file-name 0 (+ 1 (length package-user-dir))))))
       (checkdoc)))

 (add-hook 'after-save-hook 'emagician/run-checkdoc)
于 2013-04-02T19:24:59.067 回答
0

现在有elisp-flymake-byte-compile内置flymake的后端。
要启用将其添加到配置:

(add-hook 'emacs-lisp-mode-hook #'flymake-mode)
于 2020-12-29T16:19:33.233 回答