Symbol的函数定义为void:global-auto-complete-mode

Posted

技术标签:

【中文标题】Symbol的函数定义为void:global-auto-complete-mode【英文标题】:Symbol's function definition is void: global-auto-complete-mode 【发布时间】:2014-11-18 09:41:36 【问题描述】:

我正在使用 GNU Emacs 24.4.1 (x86_64-apple-darwin14.0.0) 我从 Melpa 安装了自动完成功能,并在 init.el 中有以下行:

(global-auto-complete-mode 1)

当我打开 emacs 时,它会发出警告:

Warning (initialization): An error occurred while loading `/Users/lita/.emacs.d/init.elc':

Symbol's function definition is void: global-auto-complete-mode

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.

自动完成模式没有启动。在我将 init.el 中的行更改为:

(eval-after-load 'auto-complete (global-auto-complete-mode 1))

它仍然提出了同样的警告。但是如果我 `eval-buffer,它会打开自动完成。

这有什么问题?

【问题讨论】:

【参考方案1】:

在你的初始化文件中,你应该在引用包之前调用(package-initialize)

此外,您的eval-after-load 声明中有错字。您需要引用表单,否则会立即对其进行评估,这就是您收到警告的原因。换句话说:

(eval-after-load 'auto-complete '(global-auto-complete-mode 1))

或者,您可以使用新的宏with-eval-after-load

【讨论】:

以上是关于Symbol的函数定义为void:global-auto-complete-mode的主要内容,如果未能解决你的问题,请参考以下文章