2
votes

I'm working in a fresh configuration of GNU Emacs 24.3.1. I want to use emacs-eclim with company. Company works correctly, but if I open a java file, it stops working correctly, yelling this error message:

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

my Emacs configuration:

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

and my hooks:

(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)
        ))

These are the packages I have installed, via the Emacs package manager:

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, and yasnippet.

Here is the debug information from 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
Do you have a backtrace if you start emacs with --debug-init? if yes, add it.Daimrod
See Stefan's answer. And then please report the bug to the emacs-eclim project.Dmitry
Done.shackra

2 Answers

4
votes

My crystal ball says that you're bumping into a case expression without having loaded cl beforehand. If the problem is in a byte-compiled file, you'll have to recompile the file, otherwise adding

(require 'cl)

somewhere early in your ~/.emacs file might help.

3
votes

M-x toggle-debug-on-error, then provoke the error. That will give you a backtrace showing not just the error message but what expression was being evaluated when the error was raised.

In this case, some function was expecting a function as one of its arguments, and instead of a function it was passed the list you see: (java-mode javascript-mode js-mode ruby-mode php-mode c-mode c++-mode).

Then you can look deeper in the backtrace to see how the function was passed that list argument, and so on. You can click a function name in the (left side of) the backtrace, to see its Lisp definition.