-
-
Notifications
You must be signed in to change notification settings - Fork 651
[Fix #814] Use cider-current-ns instead of nrepl-buffer-ns
#817
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Yeah, I just noticed this. @cemerick Is this a bug or a feature? Seems pretty not to return the namespace of the file just loaded. |
Yeah, the fact that the same response handler is used for both Btw, you have a typo in the commit message. |
cider-client.el
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wrote it, so I know what it does - basically we needed to make sure we're not doing interactive evaluation for non-evaluated namespaces and it that case evaluted the namespace form first. Given the way interactive evaluation works now this is redundant.
|
Apart from my tiny remarks the proposed changes look good. |
…er-ns`
Other changes:
- Don't reset `nrepl-buffer-ns` in default response handler.
- Remove `cider-find-ns` (it's confusing to have two functions doing almost
the same thing).
- Use nil global value of `nrepl-buffer-ns`. This will allow easy detection
of the cases when this variable shouldn't be used.
|
Done! |
[Fix #814] Use `cider-current-ns` instead of `nrepl-buffer-ns`
|
Btw, it seems this introduced a regression. From the mailing list: |
|
Indeed. The fix is to set the ns in the repl handler, but I wonder if this statement is meaningful from a source file? I already experienced a couple of ns related issues with the new evaluation mechanism. If the error is in ns-form and you want to fix it with something like |
Don't think so. Doesn't really make sense to do
Small price to pay for all the benefits gained. And we can always add a an interactive command based on the |
The recent interactive eval improvements essentially broke eldoc, completion and all other stuff that relies directly or indirectly on
nrepl-buffer-ns. This has to do with the fact that:load-fileop returns:mainor "user" ns and cider's default handler eagerly sets it everywhere it can. Therefore, after each interactive evaluationnrepl-buffer-nshas a wrong value.The usage of
nrepl-buffer-nsis unavoidable in special buffers (repl, scratch, macroexpanion, doc etc). It also might be used as a cache in clojure buffers, but then it should be reset to nil in buffer modification hook. It should be fine for now, but to fully set this issue straight one would need to set we need to rewrite the response handling first.Other changes:
nrepl-buffer-nsin default response handler.cider-find-ns(it's confusing to have two functions doing almost the same thing).nrepl-buffer-ns. This will allow easy detection of cases when this variable is used but shouldn't.