Emacs update-file-autoloads失败

时间:2013-08-14 21:18:06

标签: emacs

我正在尝试使用此tutorial关注此code,将emacs设置为我的GO IDE。当我必须让emacs生成文件时,我遇到了问题

  

在Emacs中,运行M-x update-file-autoloads,将其指向go-mode.el文件并告诉它生成一个go-mode-load.el文件。

输入文件路径(位置~/.emacs.d/go-mode/go-mode.el

时出现此错误
Opening output file: no such file or directory, /build/buildd/emacs23-23.3+1/debian/build-x/lisp/loaddefs.el

我在这个文件上做了locate并看到我确实拥有它,但没有在上面指定的路径上

$ locate loaddefs.el
/usr/share/emacs/23.3/lisp/loaddefs.el
...

如果我不得不猜我会说某种路径问题。我是否必须在某处设置路径变量?

我通过apt-get install emacs23

安装了emacs

我在Ubuntu 12.04上

由于

修改

我正在采取的处理错误的过程。

  1. M-x update-file-autoloads输入

  2. Update autoloads for file:〜/ .emacs.d / go-mode / go-mode.el Enter

  3. Opening output file: no such file or directory, /build/buildd/emacs23-23.3+1/debian/build-x/lisp/loaddefs.el

4 个答案:

答案 0 :(得分:2)

我遇到了同样的问题,终于让它运转了。打开暂存缓冲区(或任何其他空文件)并输入以下两行

(setq generated-autoload-file "~/.emacs.d/go-mode/go-mode-load.el")
(update-file-autoloads "~/.emacs.d/go-mode/go-mode.el")

然后通过将光标放在每行的后面来评估两行,并键入C-x C-e以评估光标前的行。为两条线都这样做。然后确保打开go-mode-load.el并保存缓冲区 - 显然emacs默认情况下不这样做。

完成此操作后,您可以继续按照http://www.honnef.co/posts/2013/03/writing_go_in_emacs/

上的说明操作

免责声明:我确信有更好的方法可以做到这一点,而且lisp专家会尖叫我的回答。我对lisp以及如何在emacs中使用lisp一无所知。我只是做了一个明智的猜测: - )

答案 1 :(得分:2)

刚刚尝试在我的覆盆子pi上设置go-mode.el时最近点击了这个。幸运的是,我已经在我的Mac上成功生成了一个go-mode-load.el文件,并且能够看一下。

在那里我看到了这个评论:

;; To update this file, evaluate the following form
;;   (let ((generated-autoload-file buffer-file-name)) (update-file-autoloads "go-mode.el"))

所以我cd已加入我下载go-mode.el的目录,然后touch编辑了一个名为go-mode-load.el的新文件,在emacs中打开,粘贴在那行代码,用C-x C-e评估它,它就像一个魅力。

修改

在我将这些行添加到最后之前,无法生成生成的文件。在撰写本文时,我没有花时间弄清楚为什么需要它们,但添加它们解决了问题:

(provide 'go-mode-load)
;; Local Variables:
;; version-control: never
;; no-byte-compile: t
;; no-update-autoloads: t
;; coding: utf-8
;; End:
;;; go-mode-load.el ends here

答案 2 :(得分:1)

(不是答案,但需要格式化) 在go-mode.el中是否有`generated-autoload-file'的本地定义?如果是这样,它会在那里写,所以你需要删除该行。


;; update-file-autoloads docs

update-file-autoloads是一个交互式编译的Lisp函数 `autoload.el”。

(update-file-autoloads FILE& optional SAVE-AFTER OUTFILE)

更新FILE的自动加载。 如果前缀arg SAVE-AFTER非零,则也保存缓冲区。

如果FILE绑定generated-autoload-file' as a file-local variable, autoloads are written into that file. Otherwise, the autoloads file is determined by OUTFILE. If called interactively, prompt for OUTFILE; if called from Lisp with OUTFILE nil, use the existing value of generated-autoload-file'。

如果其中没有自动加载cookie,则返回FILE,否则为nil。

答案 3 :(得分:0)

go-mode-el GitHub webpage查看实际的安装说明。看起来有些更改未在教程中反映出来。

尝试使用ELPA或遵循手动说明:

(add-to-list 'load-path "/place/where/you/put/it/")
(require 'go-mode-autoloads)