【发布时间】:2014-04-27 14:42:55
【问题描述】:
我的 emacs init.el 文件有问题,这让我抓狂。
我的 init.el 将加载路径设置为一堆加载项,然后调用一些要求。
Emacs 加载正常,一切正常,但 flycheck for elisp 将 init.el 中的第一个 require 语句标记为“无法打开加载文件”,如果我进行字节编译,它也会给我同样的结果错误。
我创建了一个最简单的示例来重现问题,并在 MacOs X 和 Ubuntu 上使用 emacs 24.3 (9.0) 对其进行了测试。这两个测试都给了我同样的错误。
示例如下:
;; init.el --- entry point for configuration
(add-to-list 'load-path "~/.emacs.d/.")
(add-to-list 'load-path "~/.emacs.d/exec-path-from-shell")
(require 'test)
(require 'exec-path-from-shell)
;; test.el --- test lives in "~/.emacs.d"
(defvar test-var "this is test")
(provide 'test)
错误:
vagrant@elsa:~/.emacs.d$ pwd
/home/vagrant/.emacs.d
vagrant@elsa:~/.emacs.d$ sudo make
emacs --batch --eval "(byte-recompile-directory \".\" 0)"
Loading 00debian-vars...
Loading /etc/emacs/site-start.d/50autoconf.el (source)...
Checking /home/vagrant/.emacs.d...
Compiling /home/vagrant/.emacs.d/init.el...
In toplevel form:
init.el:5:1:Error: Cannot open load file: test
Checking /home/vagrant/.emacs.d/auto-save-list...
Checking /home/vagrant/.emacs.d/bin...
Checking /home/vagrant/.emacs.d/exec-path-from-shell...
Done (Total of 0 files compiled, 1 failed, 2 skipped in 2 directories)
vagrant@elsa:~/.emacs.d$
如果我改变 require 语句的顺序 ()
(require 'exec-path-from-shell)
(require 'test)
错误会变成:
In toplevel form:
init.el:5:1:Error: Cannot open load file: exec-path-from-shell
发生了什么事?我做错了什么?
问候,罗曼
【问题讨论】: