Comments (12)
That's a known error upstream in nrepl (on the Clojure side). It will be fixed in time, but not by ac-nrepl.
from ac-nrepl.
it looks like this is actually an issue in clojure itself, as (doc clojure.set)
returns the exception above, see http://dev.clojure.org/jira/browse/CLJ-902 which seems to be fixed for clojure 1.5
One option would be to filter out exceptions returned by doc
and present nil (or ERROR) to the user.
from ac-nrepl.
That's not so easy, because the error is a compiler error, and intercepting errors thrown at the nrepl evaluation level is tricky.
Another option might be to evaluate code like that used by swank-clojure rather than relying on the possibly-broken clojure.repl/doc
fn:
https://github.com/technomancy/swank-clojure/blob/master/src/swank/commands/basic.clj#L231
from ac-nrepl.
I am puzzled why if I do this in a regular "lein repl" shell:
(complete.core/completions "clojure.set/" ns)
everything works fine. I can see all the completions.
But if I do the same in an Emacs nrepl buffer, I got the exception as described in this thread.
I am using lein2 preview 10, and nrepl.el 0.1.4 preview
Can someone explain? Thanks.
from ac-nrepl.
@wrn To make a short story long, the reason why it works in REPL-y and not in nrepl.el is that the command line version of REPL-y installs a newer version of the function resolve-class in clojure-complete.
You can see this here:
https://github.com/trptcolin/reply/blob/master/src/clj/reply/initialization.clj#L129
We don't do this when launching the nrepl server.
This particular bug has been fixed in clojure-complete (see ninjudd/clojure-complete#3 ).
So getting it fixed is a matter of getting a new version of clojure-complete released and included in lein repl.
from ac-nrepl.
Thanks. That explains it. I just re-defined the resolve-class in namespace complete.core and completions works in nrepl buffer now. So I guess I can use this as a temporary work around until the new version is out.
from ac-nrepl.
Hi folks,
Even when redefining resolve-class
in namespace complete.core
, I still get the above-mentioned ClassNotFoundException from nrepl in emacs. It's actually coming from the call to clojure.repl/doc
on line 82 of ac-nrepl.el:
https://github.com/purcell/ac-nrepl/blob/master/ac-nrepl.el#L82
Redefining ac-nrepl-documentation
as
(defun ac-nrepl-documentation (symbol)
"Return documentation for the given SYMBOL, if available."
(substring-no-properties
(replace-regexp-in-string
"\r" ""
(replace-regexp-in-string
"^\\( \\|-------------------------\r?\n\\)" ""
(plist-get (nrepl-send-string-sync
(format "(try (eval '(clojure.repl/doc %s)) (catch Exception e (println \"Doc threw an error. Namespace?\")))" symbol)
(nrepl-current-ns))
:stdout)))))
Fixes the problem. A similar issue exists in nrepl.el (https://github.com/kingtim/nrepl.el/blob/master/nrepl.el#L1486).
Does no-one else see this problem? I'll happily create pull requests if it would be useful.
Cheers,
Ian
from ac-nrepl.
I believe the issue here is possibly the use (nrepl-current-ns)
. I believe this should be nrepl-buffer-ns
.
Which version of nrepl.el are you using?
Is this occurring while editing a clojure buffer, or in the repl buffer?
If a clojure buffer, have you loaded the file using C-c C-k?
from ac-nrepl.
Yes, nrepl-buffer-ns
sounds right. Not sure where the (nrepl-current-ns)
came from in the first place, but it's trivial for me to change it if it's obviously wrong...
from ac-nrepl.
I'm using the *nrepl*
buffer. Whether or not there's an issue with (nrepl-current-ns)
, it is definitely the case that (clojure.repl/doc clojure.set)
will always throw a ClassNotFoundException, which needs to be caught (at least until we all move to clojure 1.5, where the doc
macro has been fixed).
I'm using the latest nrepl.el from the master branch.
I'm sure I'm missing something, I appreciate you folks taking the time to help!
Cheers,
Ian
from ac-nrepl.
I see.
Yes, it would appear we are going to have to wrap that doc call in a try catch.
from ac-nrepl.
Thanks guys -- I've added the fix from @daviesian and changed nrepl-current-ns
to nrepl-buffer-ns
. There's a new package (0.7) up on Marmalade.
from ac-nrepl.
Related Issues (20)
- Long docstrings in ac-nrepl-popup-doc get cut off HOT 3
- nrepl.el needs huge amounts of time to do autocompletion HOT 7
- nrepl.el needs huge amounts of time to do autocompletion HOT 1
- Support company-mode? HOT 44
- Is it possible to use ac-nrepl with ritz? HOT 5
- Intermittent error HOT 16
- ac-source-nrepl-vars conflict with yasnippet? HOT 3
- ac-nrepl displays nothing, java hogs cpu HOT 2
- ac-nrepl-popop-doc causes "Wrong type argument"
- ac-nrepl perceptibly slow. Any way to speed up? HOT 5
- Namespace hint gets expanded into the code HOT 12
- No completion for unsourced namespace HOT 3
- references to nrepl-current-ns break when used with cider HOT 1
- Documentation pop-up only in repl, not in file buffers HOT 12
- ac-nrepl makes auto-complete very slow HOT 1
- Solved: ac-nrepl installed via package.el doesn't work because `cider-0.1' is unavailable HOT 2
- Remove eval'd clojure code in favor of cider's cider-dispatch-complete-symbol HOT 9
- ac-fuzzy-complete not works HOT 5
- .emacs slowdown HOT 5
- No pop up document is showing HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ac-nrepl.