2

我正在使用 GNU Emacs 24.3.1 的全新配置。我想与公司一起使用 emacs-eclim。公司工作正常,但如果我打开一个 java 文件,它会停止正常工作,并大喊以下错误消息:

Company: An error occurred in auto-begin 
Invalid function: (java-mode javascript-mode js-mode ruby-mode php-mode c-mode c++-mode)

我的 Emacs 配置:

(require 'iso-transl)
(require 'recentf)
(require 'recentf-ext)
(require 'eclim)
(require 'company-emacs-eclim)
(require 'eclimd)

和我的钩子:

(add-hook 'after-init-hook
      (lambda ()
         (iswitchb-mode)
         (helm-mode 1)
         (auto-indent-global-mode)
         (toggle-diredp-find-file-reuse-dir 1)
         (recentf-mode 1)
         (global-flycheck-mode)
         (auto-indent-global-mode)
         (autopair-global-mode)
         (projectile-global-mode)
         (global-pretty-mode)
         (global-eclim-mode)
         (global-company-mode t)
         (yas-global-mode 1)))

(add-hook 'java-mode-hook
      (lambda ()
        (company-emacs-eclim-setup)
        (help-at-pt-set-timer)
        ))

这些是我通过 Emacs 包管理器安装的包:

ace-jump-mode, auto-indent-mode, autopair, company, dash, dired+, emacs-eclim, epl, f, flycheck, fringe-helper, helm, helm-company, helm-flycheck, helm-projectile-all, hexrgb, java-snippets, javadoc-lookup, multi-term, multiple-cursors, pkg-info, powerline, pretty-mode, projectile, recentf-ext, s, sublime-themes, visual-regexp, visual-regexp-steroids,和 yasnippet。

这是来自 Emacs 的调试信息:

Debugger entered--Lisp error: (invalid-function (java-mode javascript-mode js-mode ruby-mode php-mode c-mode c++-mode))
  (java-mode javascript-mode js-mode ruby-mode php-mode c-mode c++-mode)(128)
  eclim-completion-start()
  (let ((start (eclim-completion-start))) (if start (progn (buffer-substring-no-properties start (point)))))
  (cond ((eql command (quote interactive)) (company-begin-backend (quote company-emacs-eclim))) ((eql command (quote prefix)) (let ((start (eclim-completion-start))) (if start (progn (buffer-substring-no-properties start (point)))))) ((eql command (quote candidates)) (company-emacs-eclim--candidates arg)) ((eql command (quote annotation)) (company-emacs-eclim--annotation arg)) ((eql command (quote meta)) (eclim--completion-documentation (concat arg (company-emacs-eclim--annotation arg)))) ((eql command (quote no-cache)) (equal arg "")) ((eql command (quote ignore-case)) t) ((eql command (quote sorted)) t) ((eql command (quote post-completion)) (let ((ann (company-emacs-eclim--annotation arg))) (if ann (progn (insert ann))) (eclim--completion-action))))
  company-emacs-eclim(prefix)
  #[0 "\n\203   [LONG STRING THAT CANNOT BE COPY]
  company--begin-new()
  company-begin()
  #[0 "\300 \207" [company-begin] 1 "\n\n(fn)"]()
  company-auto-begin()
  company-manual-begin()
  company-complete-common()
  call-interactively(company-complete-common record nil)
  command-execute(company-complete-common record)
  execute-extended-command(nil "company-complete-common")
  call-interactively(execute-extended-command nil nil)
4

2 回答 2

4

我的水晶球说你在case没有事先加载的情况下碰到一个表情cl。如果问题出在字节编译文件中,则必须重新编译该文件,否则添加

(require 'cl)

文件中早期的某个地方~/.emacs可能会有所帮助。

于 2014-05-07T12:48:33.433 回答
3

M-x toggle-debug-on-error,然后引发错误。这将为您提供回溯,不仅显示错误消息,还显示错误引发时正在评估的表达式。

在这种情况下,一些函数期望一个函数作为它的参数之一,而不是一个函数,它被传递给你看到的列表:(java-mode javascript-mode js-mode ruby-mode php-mode c-mode c++-mode).

然后,您可以更深入地查看回溯,以查看函数是如何传递该列表参数的,等等。您可以单击回溯(左侧)中的函数名称,以查看其 Lisp 定义。

于 2014-05-07T05:33:25.417 回答