ac-js2 icon indicating copy to clipboard operation
ac-js2 copied to clipboard

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

Open ghost opened this issue 11 years ago • 4 comments

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

ghost avatar Nov 21 '14 17:11 ghost

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)

ripple0328 avatar Feb 15 '15 08:02 ripple0328

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

ghost avatar Feb 16 '15 14:02 ghost

Thanks, it works for me

ripple0328 avatar Feb 17 '15 01:02 ripple0328

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)

dunn avatar Aug 05 '15 04:08 dunn