控制字节编译的详细程度(CL库)

7 emacs elisp compilation

当批量编译几个eLisp文件时,编译器的输出会出现Warning: function `position' from cl package called at runtime警告.我理解,虽然对cl包装政策不太满意.但这使得发现其他更有用的警告变得更加困难.那么,虽然没有真正的方法来避免警告,有没有办法有选择地关闭某种模式的所有警告?

编辑:(附一个例子)

创建名为doodles.el的文件

(require 'cl)
(eval-when-compile (require 'cl))

(dotimes (i 1)
  (position ?\x "x"))
Run Code Online (Sandbox Code Playgroud)

M-x byte-compile-file RET doodles.el

切换到*Compile-Log*缓冲区:

doodles.el:1:1:Warning: cl package required at runtime
Run Code Online (Sandbox Code Playgroud)

这就是你得到的.

use*_*342 5

您可以使用设置byte-compile-warnings变量的局部变量块来控制字节编译器警告.要关闭CL-at-runtime警告,请将其放在模块末尾附近:

;; Local Variables:
;; byte-compile-warnings: (not cl-functions)
;; End:
Run Code Online (Sandbox Code Playgroud)