【问题标题】:Installing auto-complete in emacs在 emacs 中安装自动完成
【发布时间】:2015-01-05 10:50:06
【问题描述】:

我是 Emacs 新手,我下载了 auto-complete,将其移至 ~/.emacs.d/plugins/ 然后修改 .emacs 文件如下所示:

(add-to-list 'load-path (file-name-as-directory
                     (expand-file-name "~/.emacs.d/plugins/auto-complete"))\
)

(require 'auto-complete)
(global-auto-complete-mode t)

(ac-config-default)
(custom-set-variables
;; custom-set-variables was added by Custom.                                   
;; If you edit it by hand, you could mess it up, so be careful.                
;; Your init file should contain only one such instance.                       
;; If there is more than one, they won't work right.                           
'(menu-bar-mode nil)
'(package-archives (quote (("melpa" . "http://stable.melpa.org/packages/") ("g\
nu" . "http://elpa.gnu.org/packages/")))))
(custom-set-faces
;; custom-set-faces was added by Custom.                                       
;; If you edit it by hand, you could mess it up, so be careful.                
;; Your init file should contain only one such instance.                       
;; If there is more than one, they won't work right.                           
)

当我重新启动 emacs 时,它显示以下错误:

Warning (initialization): An error occurred while loading `/Users/zeaksilva/.emacs':

File error: Cannot open load file, auto-complete

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.

【问题讨论】:

  • 我不确定这是否是主题,但似乎在Emacs 上可能更合适。
  • @MatthewHaugen:为什么不在这里(也)成为主题?现在我们在两个地方都有same question。没有帮助,恕我直言。如果您想将它从这里迁移到那里(我认为不需要),那么就这样做。至少这不会导致问题的重复和答案的分散。
  • auto-complete 使用第三方 ELPA 存储库(如 Marmalade,您似乎已经在使用)更容易安装,为什么还要手动下载并尝试安装?
  • 您的代码看起来不错,所以问题可能与 emacs 无关。文件名有错别字吗?要加载的文件是否以 .el 或 .elc 结尾?您可以手动(加载...)文件吗? (你知道你可以通过将光标移到它后面并按 C-x C-e 来执行 emacs lisp 表达式)

标签: emacs


【解决方案1】:

(setq debug-on-error t) 放在初始化文件的开头。或者更好的是,将--debug-init 附加到您用来调用Emacs 的命令行中。这将在发生错误时打开调试器。但似乎包含(provide 'autocomplete) 的文件或该文件的目录不在您的load-path 中。调试器打开后,使用C-h v load-path,看看是否正确。

并尝试注释掉您的 init 文件中的所有额外内容,这似乎与此问题无关:custom-set-variablescustom-set-faces。 IOW,简化您尝试调试的内容。

【讨论】:

    猜你喜欢
    • 2023-03-10
    • 2016-06-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-05-04
    • 2011-05-15
    相关资源
    最近更新 更多