[英]I get a error when I try install auto-complete in emacs
我是emacs的新手...我已经有几天了,我觉得emacs很棒但是当我尝试安装自动完成时出现错误...我从http://cx4a.org/software/安装它自动完成/安装工作(我使用makefile)...但是当我把这些行放在我的emacs.d中
(add-to-list 'ac-dictionary-directories "~/.emacs.d/ac-dict")
(require 'auto-complete-config)
(ac-config-default)
我收到这个错误
Warning (initialization): An error occurred while loading `/home/yo/.emacs':
Symbol's value as variable is void: ac-dictionary-directories
To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file. Start Emacs with
the `--debug-init' option to view a complete error backtrace
我在/home/yo/.emacs中有我的文件夹.emacs,在这里我有文件夹ac-dic..inside这里有c ++ mode..lisp模式ruby模式... etc..etc ...等等.....
我的autocomplete.el也在我的.emacs里面...我做错了什么?...谢谢!
ac-dictionary-directories
在auto-complete.el中定义,所以显然emacs不会找到它。 所以只需更改语句的顺序:
(require 'auto-complete-config)
(ac-config-default)
(add-to-list 'ac-dictionary-directories "~/.emacs.d/ac-dict")
现在,它应该工作。
我怀疑问题是add-to-list
想要预先添加到现有列表中,但是在你调用它时没有这样的变量。
你可以使用(setq 'ac-dictionary-directories "~/.emacs.d/ac-dict")
代替或者按照add-to-list帮助中的建议:
如果你想在
add-to-list' on a variable that is not defined until a certain package is loaded, you should put the call to
使用“add-to-list' on a variable that is not defined until a certain package is loaded, you should put the call to
add-to-list'add-to-list' on a variable that is not defined until a certain package is loaded, you should put the call to
放入一个钩子函数中,该函数只有在加载包之后才能运行。 “eval-after-load”提供了一种方法。 在某些情况下,其他钩子,例如主模式钩子,可以完成这项工作。
换句话说,像:
(eval-after-load 'auto-complete-config
'(add-to-list 'ac-dictionary-directories "~/.emacs.d/ac-dict"))
或者,最后,你可以在require
之后设置变量,但我不确定它是如何与auto-complete的初始化相互作用的。
.emacs.
通常是elisp文件, .emacs.d
是目录。 看起来你正在反过来对待它们。 你把它
(add-to-list 'ac-dictionary-directories "~/.emacs.d/ac-dict")
(require 'auto-complete-config)
(ac-config-default)
在~/.emacs
,而不是.emacs.d
。
或者,你的问题不明确。 你的~/.emacs
什么样的?
编辑:
或者,你想做
(add-to-list 'load-path "~/.emacs.d/ac-dict")
(require 'auto-complete-config)
(ac-config-default)
代替
(add-to-list 'ac-dictionary-directories "~/.emacs.d/ac-dict")
(require 'auto-complete-config)
(ac-config-default)
我在/home/yo/.emacs中有我的文件夹.emacs,在这里我有文件夹ac-dic..inside这里有c ++ mode..lisp模式ruby模式... etc..etc ...等等.....
~/.emacs
应该是一个文件。 不是目录。
但是当我把这些行放在我的emacs.d中时
~/.emacs.d/
应该是一个目录
我有这个问题。 这是因为我从其他计算机复制了自动完成文件。 为了解决它,我重新下载源代码然后我重新编译它并复制到我的.emacs.d cd auto-complete make byte-compile cp *.el *.elc ~/.emacs.d
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.