clojure-emacs / ac-nrepl

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

Documentation pop-up only in repl, not in file buffers #44

Closed robinheghan closed 11 years ago

robinheghan commented 11 years ago

Like the title says. I only get documentation (and function arguments) when in the repl buffer, not in source code. I do get general auto-completion though.

purcell commented 11 years ago

Which version are you using, and what corresponding configuration do you have in your emacs init files?

robinheghan commented 11 years ago

I using todays version on Melpa.

;; init.el

(require 'auto-complete-config) (require 'ac-nrepl) (ac-config-default) (add-hook 'cider-repl-mode-hook 'ac-nrepl-setup) (add-hook 'cider-interaction-mode-hook 'ac-nrepl-setup) (eval-after-load "auto-complete" '(add-to-list 'ac-modes 'cider-repl-mode))

(defun set-auto-complete-as-completion-at-point () (setq completion-at-point-functions '(auto-complete))) (add-hook 'auto-complete-mode-hook 'set-auto-complete-as-completion-at-point) (add-hook 'cider-repl-mode-hook 'set-auto-complete-as-completion-at-point) (add-hook 'cider-interaction-mode-hook 'set-auto-complete-as-completion-at-point)

purcell commented 11 years ago

Sometimes this can result from trying to auto-complete in a Clojure buffer which defines a namespace that has not yet been created, so you might just need to compile the file you're working on so that the namespace is fully defined.

robinheghan commented 11 years ago

Well, this is true for simple functions like "dec" or "defn" also :/ Btw, does this mean that I should AOT my clojure code to get auto-completion/docs?

purcell commented 11 years ago

No, but you should generally C-c C-k your files before working in them, so if you create a new file which defines a new namespace, you should hit C-c C-k after adding the (ns ...) form.

So can you confirm whether doing this makes a difference in your case?

robinheghan commented 11 years ago

I entered my source file. Used cider-jack-in, and C-c C-k. No difference. cider-doc works just fine though

purcell commented 11 years ago

Okay, cool. That gives me more to go on. And do you get any ac-nrepl completion results in the Clojure buffer? These would be results with the symbol "v", "c", "m", "n" or "s" on the right-hand-side of the auto-complete dropdown?

sw1nn commented 11 years ago

I had a similar problem. I think it's because cider-interaction-mode is now just cider-mode. Some things are aliased, but dropping the 'interaction' fixed it for me.

purcell commented 11 years ago

Thanks Neale. That would make sense. I just yesterday (?) updated the suggested ac-nrepl setup code to reflect this, because someone pointed out to me that the mode had been renamed.

purcell commented 11 years ago

Hey @bbatsov: it would probably make sense to just drop the cider-interaction-mode alias rather than risk breakage like this, if that is indeed the cause.

bbatsov commented 11 years ago

@purcell Will do! I've added the aliases with the idea to avoid breakages, but oddly enough they had the opposite effect. I guess mode aliases are problematic.

robinheghan commented 11 years ago

Changing from cider-interaction-mode to cider-mode did the trick, thanks for all help :)