每次我以 emacs lisp 模式保存文件时,我都希望它自动进行字节编译。有人能想出一个函数吗byte-compile-file
如果当前主要模式是 emacs lisp 模式,则在当前文件上?我要add-hook
该函数到 after-save-hook
.
最佳答案
我找到了答案 here .以下是全部。它是来自链接站点的副本。
(add-hook 'after-save-hook
(lambda ()
(if (eq major-mode 'emacs-lisp-mode)
(save-excursion (byte-compile-file buffer-file-name)))))
关于emacs - 保存时自动字节编译,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6145176/