这个是配合 auto-compile.el 一起使用的,因为必须先创建了 elc 文件,auto-compile.el 才会在修改或升级 el 的时候更新它。
#!/usr/local/bin/emacs --script
(normal-top-level-add-subdirs-to-load-path)
;; 这行是用来生成 elc 的, 注意,只有 elc 更新了,eln 才会被更新.
(byte-recompile-directory "~/Dropbox/common/.emacs.d/plugins" 0 nil)
;; 下面的脚本用力生成 eln 的
(native-compile-async "~/Dropbox/common/.emacs.d/plugins" 'recursively)
(while (or comp-files-queue
(> (comp-async-runnings) 0))
(sleep-for 1))
(if (and (fboundp 'native-comp-available-p)
(native-comp-available-p))
(message "Native compilation is available")
(message "Native complation is *not* available"))
(if (functionp 'json-serialize)
(message "Native JSON is available")
(message "Native JSON is *not* available"))
修改 “ ~/Dropbox/common/.emacs.d/plugins" 为你的包路径。
当然,如果你使用包管理,这个事情可能已经自动帮你做了。