ScottyB / ac-js2

Javascript auto-completion in Emacs using Js2-mode's parser and Skewer-mode.
123 stars 8 forks source link

error: (invalid-function ac-define-source) #18

Open ghost opened 9 years ago

ghost commented 9 years ago

in the update of last versión of auto-complete-mode I get this error when I try to enable ac-js2

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(toggle)
  #<subr call-interactively>(ac-js2-mode record nil)
  ad-Advice-call-interactively(#<subr call-interactively> ac-js2-mode record nil)
  apply(ad-Advice-call-interactively #<subr call-interactively> (ac-js2-mode record nil))
  call-interactively(ac-js2-mode record nil)
  command-execute(ac-js2-mode record)
  execute-extended-command(nil "ac-js2-mode")
  #<subr call-interactively>(execute-extended-command nil nil)
  ad-Advice-call-interactively(#<subr call-interactively> execute-extended-command nil nil)
  apply(ad-Advice-call-interactively #<subr call-interactively> (execute-extended-command nil nil))
  call-interactively(execute-extended-command nil nil)
  command-execute(execute-extended-command)

I think that is solved with (eval '(ac-define-source "js2" on line 285

ripple0328 commented 9 years ago

I got the same issue, could you @Distopico explain more about how to solve it?

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)
  apply(run-hooks (change-major-mode-after-body-hook prog-mode-hook js2-mode-hook))
  run-mode-hooks(js2-mode-hook)
  js2-mode()
  set-auto-mode-0(js2-mode nil)
  set-auto-mode()
  normal-mode(t)
  after-find-file(nil t)
ghost commented 9 years ago

@ripple0328 just replace line 285 https://github.com/ScottyB/ac-js2/blob/master/ac-js2.el#L285 with this (eval '(ac-define-source "js2"

ripple0328 commented 9 years ago

Thanks, it works for me

dunn commented 9 years ago

What also works (for me at least) is to use this as the hook in your init file:

(add-hook 'js2-mode-hook 'ac-js2-setup-auto-complete-mode)