-
-
Notifications
You must be signed in to change notification settings - Fork 648
[Fix #950] Check for existence of ns in cider-interactive-eval
#956
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
This way we'll be doing an extra eval request every time, which would also obscure the log quite a bit. I've considered this originally, but I decided it's not worth it. Getting |
I don't think log output should decide if a feature is worth it or not. Additional eval takes mseconds and it's not noticibele even on remotes. We can add an enhancement to the logger to abbreviate some ouput if a request has
Well, the major point of using Alternatively, a custom eval middleware should be designed. Maybe it should be done once and for all. This elisp hackery around eval started getting annoying. The |
There are other reasons I dislike this idea - it doesn't handle changes in the
I'm confused, as I don't understand what you mean by this extra
Ideally all of this should be handled in nREPL itself (especially the location tracking). Unfortunately I have no time to work on this and AFAIK neither does @cemerick. Still, even such changes will not handle |
Aha! Could we then explicitly check for clojure script and do eval as normal, otherwise do the old load-file aproach for clojure?
What could go wrong? As @cemerick pointed out last time, ns evaluation is pretty harmless in clojure. If namespace is already loaded, nothing special happens. |
I'd like to keep the behaviour for Clojure and ClojureScript the same. Many people use both and will constantly be confused about the different behaviour (I know I would be).
We might create a Once again - for me it will be enough to simply have |
This might a pretty good solution, btw - it will require no changes to the middleware, the logs will look fine and it won't be problematic on ClojureScript. And I've just figured out how we can handle in a smart way the ns form of a particular buffer - we can keep track of what the ns form was last time something was evaled in the buffer and re-eval it only if there's some difference. Actually, if we do this we won't have to handle |
Sounds like a good idea! |
@vspinu Would you like to take a stab at implementing this? |
Yes. I will look into it right now. |
Ok. Please have a look. I am essentially reverting 1dba82f and thus restoring source refs. The assumption is that the simple |
@vspinu Using |
Limit the scope of the change to simply tracking |
Hm. I have now read the whole #830. The problem is pretty dare I must say. Let's introduce a var (not a user option) |
Let's not overcomplicate things unless 100% necessary. We'll still get proper location info when using |
P.S. We can also add a simple check in |
dcc44cb
to
b6041d7
Compare
Fixed.
I think people expect to see the result on C-c C-e and, as clojurescript is not returning the last value, it might be confusing. So let's not complicate things for now. |
The current state of the change looks good to me. Add a changelog entry saying we're now keeping track of the I'd also suggest changing the commit message to something like "Auto-eval source buffer ns form when needed" as the current message is a bit vague. |
Done. |
[Fix #950] Check for existence of ns in `cider-interactive-eval`
I am fixing this by porting the strategy from
cider-interactive-source-tracking-eval
, but with preliminary check if ns has been defined. This is necessary to avoid triggeringnamespace not found
error in eval middleware.