Fixed problem with void ac-define-source. Unicode symbol on ac. #9

wants to merge 7 commits into


None yet
5 participants

We definetly use differend indentation settings. So this diff is huge, but the only important part is:

(defvar ac-source-js2
  '((candidates . ac-js2-ac-candidates)
    (document . ac-js2-ac-document)
    (prefix .  ac-js2-ac-prefix)
    (symbol . "")
    (requires . -1)))

(defun ac-js2-setup-auto-complete-mode ()
  "Setup ac-js2 to be SED with auto-complete-mode."
  (add-to-list 'ac-sources 'ac-source-js2)

This solved problem with ac-define-source function void on my setup.

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

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.

yibe commented Oct 1, 2013

@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 required 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.)


ScottyB commented Nov 12, 2013

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.


ScottyB commented Nov 12, 2013

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.

@ScottyB ScottyB referenced this pull request Nov 12, 2013


Lack of release tag #8

vampolo commented Nov 20, 2013

I had the same issue and I've fixed with the code by @marcinant

rgrinberg added a commit to rgrinberg/merlin that referenced this pull request Jan 22, 2014

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.

@marcinant marcinant closed this Apr 9, 2014

asmanur added a commit to ocaml/merlin that referenced this pull request Jun 15, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment