Closed marcinant closed 10 years ago
I have a similar error without tampering with the default sources.
Debugger entered--Lisp error: (invalid-function ac-define-source)
ac-define-source("js2" ((candidates . ac-js2-ac-candidates)
(document . ac-js2-ac-document) (prefix . ac-js2-ac-prefix) (requires . -1)))
ac-js2-setup-auto-complete-mode()
ac-js2-mode()
run-hooks(change-major-mode-after-body-hook prog-mode-hook js2-mode-hook)
The macro ac-define-source is defined in the autocomplete package. I have made sure to call the setup code for autocomplete before the ac-js2 code.
I have tried adding the auto-complete requirement to no avail. @marcinant any pointers as to why does it think it is undefined?
@PuercoPop No idea. I'm not an advanced Lisp hacker. This language is so incredible weird that sometimes I really don't understand why something is ok, and why sometimes is not :)
I just copied solutions from other modes related to auto-complete. ac-define-source is described in documentation but doesn't work for some reason. You should file an issue on auto-complete repo.
@PuercoPop I got the same error and in my case it was a byte compilation issue.
When you byte-compile Emacs Lisp code, if there are macro calls in it, those macros must already be defined at that point in order to be properly expanded (see Macros and Byte Compilation).
In the case of ac-js2.el
, however, where the dependency on AC is optional, AC is not require
d in the file and thus the macro ac-define-source
is not defined during compilation.
The solution I can think of is to prevent the (ac-define-source ...)
part from being byte-compiled by replacing it with (eval '(ac-define-source ...))
. (Of course remember to byte-recompile the file after editing it.)
@marcinant Sorry for taking so long to get back to you on this issue! Could you please modify the pull request, removing all the whitespace changes? What was the issue relating to the unicode symbol? I think I must be missing something.
@yibe Thanks for the informative comment. Just out of curiosity is there another way to solve this problem? Once this pull request has been merged in I'll make that change so others don't have the same issue.
I had the same issue and I've fixed with the code by @marcinant
Apparently something has changed in auto-complete, because on my config your new code is working out of the box. So I think that we could drop this PR.
We definetly use differend indentation settings. So this diff is huge, but the only important part is:
This solved problem with ac-define-source function void on my setup.