ac-nrepl does work on the REPL buffer, but not on .clj buffers
tbatchelli opened this issue · 20 comments
This could be a configuration issue, but I have set up ac-nrep according to the instructions and although it works well for nrepl buffers, it ails on any clojure file.
The failure is:
- The list of symbols is not complete, e.g. "clojure.set/" only shows "clojure.set/difference" and "clojure.set/intersection" as completions, but it should list "clojure.set/difference" "clojure.set/index" "clojure.set/intersection" "clojure.set/join" "clojure.set/map-invert" "clojure.set/project" "clojure.set/rename" "clojure.set/rename-keys" "clojure.set/select" "clojure.set/subset?" "clojure.set/superset?" "clojure.set/union"
- The documentation is not shown for any symbol
Bear with me because I don't have time to investigate this for a couple of days. The first point may be a limitation of nrepl.el's current completion support -- maybe you could compare the results with those for the regular nrepl completion?
I had actually verified the results before:
user> (complete.core/completions "clojure.set/" *ns*)
("clojure.set/difference" "clojure.set/index" "clojure.set/intersection" "clojure.set/join" "clojure.set/map-invert" "clojure.set/project" "clojure.set/rename" "clojure.set/rename-keys" "clojure.set/select" "clojure.set/subset?" "clojure.set/superset?" "clojure.set/union")
I have no idea why this works while at the *nrepl*
buffer, but not on *.clojure
buffers. I tried the above command from a different namespace (other than 'user', but I got the same good result as above.
I have also updated auto-complete
to the latest in melpa
, but with the same results.
I don't rule out this being a configuration issue on my side...
Thanks again!
On Aug 13, 2012, at 5:04 PM, Steve Purcell notifications@github.com wrote:
Bear with me because I don't have time to investigate this for a couple of days. The first point may be a limitation of nrepl.el's current completion support -- maybe you could compare the results with those for the regular nrepl completion?
—
Reply to this email directly or view it on GitHub.
Antoni Batchelli
- twitter: @tbatchelli , @disclojure
--- email: tbatchelli@gmail.com
----- web: tbatchelli.org , disclojure.org
Hmm... I can't even complete any pattern like "name.space/" without getting a ClassNotFoundException
. For plain (non-namespaced) symbols, everything works fine, including documentation. I've got Clojure 1.4, and I'm connecting with nrepl-jack-in
-- what are you using?
-Steve
Seems this is an error in complete.core
: see clojure-emacs/cider#63 for more info.
I doubt this will get fixed in clojure 1.3 or clojure 1.4 though.
IIRC, swank-clojure has a fixed implementation of the completion function to get around that.
On Aug 23, 2012, at 9:15 AM, Steve Purcell notifications@github.com wrote:
Seems this is an error in complete.core: see clojure-emacs/cider#63 for more info.
—
Reply to this email directly or view it on GitHub.
Antoni Batchelli
- twitter: @tbatchelli , @disclojure
--- email: tbatchelli@gmail.com
----- web: tbatchelli.org , disclojure.org
It's possible that the fix in ninjudd/clojure-complete#3 will magically fix matters for those Clojure versions.
But I'll certainly consider using swank-clojure's
function definition as a payload to work around this problem if necessary, because I want ac-nrepl to work everywhere that nrepl does.
I was having this problem and it turned out to be due to a documentation error in the README:
(add-hook 'clojure-nrepl-mode-hook 'ac-nrepl-setup)
should be
(add-hook 'clojure-mode-hook 'ac-nrepl-setup)
Ah, thanks @johnwayner -- yes and no.
It should actually be:
(add-hook 'nrepl-mode-hook 'ac-nrepl-setup)
though in practice your suggestion would also work.
I'll update the documentation accordingly.
-Steve
Sorry, I meant nrepl-interaction-mode-hook
. Though I guess it's possible to have a working nrepl
connection without having loaded nrepl-interaction-mode
in a clojure-mode
buffer, so there's a good argument for your suggestion too.
I don't see an nrepl-interaction-mode-hook
in nrepl.el and emacs doesn't find any such variable (C-h v). Where is that defined? Also, using that doesn't seem to work for me. My clojure-mode
buffers have the nrepl-interaction-mode
minor associated with them, but I don't think the ac-nrepl-setup
function has run.
Oh yeah, you'll probably want to change the top of ac-nrepl.el
to reflect whatever the final solution is to this issue since it still has the old hook name.
Using nrepl-interaction-mode-hook
works perfectly for me with the latest nrepl
snapshot build from Melpa (http://melpa.milkbox.net), so that's the way forward. I've updated both the README and the ac-nrepl.el
header accordingly.
Yes, you're right. Either getting the latest from Melpa or actually evaluating my .clj file got everything working. I think I'll just blame the earlier failure on my pre-coffee state.
Thanks for the clarification and the project.
@johnwayner Lack of coffee always has a lot to answer for. :-)
It works better now, but not fully for me:
- In the REPL all works fine and the documentation pops up as expected
- In a regular clojure buffer though, the same function will complete, but the documentation won't pop up. Instead, I get a message in the minibuffer: "Namespace not found.". But no amount of waiting will produce a documentation pop up.
This was with ac-nrepl 1.3 and snapshot from MELPA and nrepl snapshot from MELPA (as 1.4 is not released yet)
@tbatchelli Is the clojure buffer compiled? I am still seeing various issues with completion in clojure buffers, but I can get popup documentation for symbols defined inside a namespace which I have myself defined.
With the package of code bundled into leiningen-2.0.0-preview10
(nrepl, complete.core etc), there is a limit to how much can work correctly at this stage.
@purcell Certainly, that was the issue. I hadn't compiled that buffer, although the symbols I was trying to complete were in clojure.core. After compiling the buffer the documentation shows up.
I'll be testing as all these moving pieces keep moving :)
Just a note to say with the current latest pieces, ac-nrepl
works for me in both the nREPL
buffer and also clojure-mode
buffers.
Is it safe to close this issue now?
Yeah, I think so. If it's still broken for @tbatchelli, he can feel free to reopen this issue.