Emacs - 公司:自动开始无效功能发生错误

时间:2014-05-07 04:33:40

标签: java emacs elisp intellisense eclim

我正在使用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,多项,多游标,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)

2 个答案:

答案 0 :(得分:4)

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

(require 'cl)

~/.emacs文件中的某个位置可能有所帮助。

答案 1 :(得分:3)

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

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

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