clojure-emacs / ac-nrepl

[DEPRECATED] Emacs auto-complete backend for nrepl completions
74 stars 11 forks source link

Just not working, how to debug ? #7

Closed deflexor closed 12 years ago

deflexor commented 12 years ago

Hello, i installed everything as described, "AC" and "nREPL" modes enabled, but no signs of popups or something similar, how to debug what is wrong ?

init.el:

;; autocomplete (add-to-list 'load-path "~/.emacs.d") ; This may not be appeared if you have already added. (require 'auto-complete-config) (ac-config-default) (add-to-list 'ac-dictionary-directories "~/.emacs.d/ac-dict") ;; nrepl (require 'ac-nrepl) (add-hook 'nrepl-mode-hook 'ac-nrepl-setup) (add-hook 'nrepl-interaction-mode-hook 'ac-nrepl-setup) (eval-after-load "auto-complete" '(add-to-list 'ac-modes 'nrepl-mode))

purcell commented 12 years ago

Please can you first confirm that auto-complete is working in other buffers, e.g. emacs lisp?

purcell commented 12 years ago

One thing you can try is manually triggering auto-completion using Meta-TAB or M-x auto-complete.

deflexor commented 12 years ago

Manual triggering works, although it displays completion variants in minibuffer, not in popup.

purcell commented 12 years ago

Aha, then you are triggering nrepl's built-in completion, not AC. Try adding this to your config:

;; hook AC into completion-at-point
(defun set-auto-complete-as-completion-at-point-function ()
  (setq completion-at-point-functions '(auto-complete)))
(add-hook 'auto-complete-mode-hook 'set-auto-complete-as-completion-at-point-function)

(add-hook 'nrepl-mode-hook 'set-auto-complete-as-completion-at-point-function)
(add-hook 'nrepl-interaction-mode-hook 'set-auto-complete-as-completion-at-point-function)

That should make TAB trigger AC instead.

deflexor commented 12 years ago

Hello, i made this changes but nothing changed, editor demonstrates competely same behaviour.

purcell commented 12 years ago

As requested earlier, though, please can you first confirm that auto-complete is working in other buffers, e.g. emacs lisp?

deflexor commented 12 years ago

No, AC not working in other buffers either

purcell commented 12 years ago

Using the default auto-complete config you should at least be able to complete words using dictionary words or words in the same buffer. If that simple case does not work, then the problem lies in your basic auto-complete setup.

You could try

(setq ac-trigger-key (kbd "TAB"))

so that you can trigger AC directly with TAB, but even without that code, AC popups should appear after a 2 second delay.

What happens when you try M-x auto-complete?

And which Emacs version are you using?

deflexor commented 12 years ago

GNU Emacs 23.3.1

M-x auto-complete:

Debugger entered--Lisp error: (wrong-type-argument stringp nil) read-from-string(nil) ac-nrepl-candidates() ac-candidates-1(((candidates . ac-nrepl-candidates) (available . ac-nrepl-available-p) (candidate-face . ac-nrepl-candidate-face) (selection-face . ac-nrepl-selection-face) (prefix . ac-nrepl-symbol-start-pos) (symbol . "n") (document . ac-nrepl-documentation))) ac-candidates() ac-update(t) ac-update-greedy(t) auto-complete() call-interactively(auto-complete t nil) execute-extended-command(nil) call-interactively(execute-extended-command nil nil)

purcell commented 12 years ago

Okay, so there are 2 separate problems here: a) auto-complete triggering isn't working for you, and b) ac-nrepl completion is throwing an error.

For a), I'm not sure why my suggested code snippet above didn't work for you, because that's exactly what I do. Perhaps you can post the full config you're now using, and I'll try to reproduce the problem locally.

Regarding b), the stacktrace above indicates a problem that has been fixed in nrepl, but not yet released. I've now patched it in ac-nrepl, so please update to version 0.5, or switch to using the Melpa snapshot packages of nrepl and ac-nrepl (http://melpa.milkbox.net). (Background: the error occurred because the clojure namespace of the current file was undefined -- try compiling the file with C-c C-k, then try M-x auto-complete again.)

deflexor commented 12 years ago

Thank you very much for help, issue is resolved by upgrading to emacs 24.