我现在通过 MELPA 和 Marmalade 尽可能多地安装,并且使用 git 管理我的 ~/.emacs.d。但是,我有 git ignore *.elc 文件。
这意味着当我在一个系统上安装一个软件包然后开始使用另一个系统时,git pull
只会给我 *.el 文件。使用这些文件通常比使用 *.elc 慢。
我尝试将以下内容添加到 ~/.emacs.d/init.el:
;; load the packages we've installed. Note that package-install
;; byte-compiles the packages, but .elc is ignored by git so we force recompilation here
(byte-recompile-directory (expand-file-name "~/.emacs.d/elpa") 0)
(package-initialize)
不幸的是,这并不等同于 package.el 完成的编译。例如,如果我安装 emacs-eclim,package.el 不会编译 emacs-eclim/company-emacs-eclim.el,我会收到以下错误:
Leaving directory `/home/wilfred/.emacs.d/elpa'
Compiling file /home/wilfred/.emacs.d/elpa/emacs-eclim-20130310.1237/company-emacs-eclim.el at Mon Mar 11 15:40:01 2013
Entering directory `/home/wilfred/.emacs.d/elpa/emacs-eclim-20130310.1237/'
company-emacs-eclim.el:35:1:Error: Cannot open load file: eclim
Warning: reference to free variable `multiple-cursors-mode'
Warning: reference to free variable `mc--read-char'
Warning: assignment to free variable `mc--read-char'
Warning: reference to free variable `multiple-cursors-mode'
Warning: reference to free variable `mc--read-quoted-char'
Warning: assignment to free variable `mc--read-quoted-char'
Warning: reference to free variable `rectangular-region-mode'
Warning: reference to free variable `rectangular-region-mode'
如何使 Emacs 只对与 package.el 相同的文件进行字节编译?