Fork me on GitHub
Drew Verlee21:03:00

i evaled some code and got a "unable to resolve symbol" exception. That's fine, whats not fine is that it moved my cursor to the exception buffer, despite me having cider-auto-select-error-buffer ni and, in the window where the error happened, It jumped all the way to the top of the namespace.


Does the cursor move to the top of the buffer if the error buffer is shown and immediately quit with q That is the approach I take. I've never noticed the cursor moving Tomorrow, I'll try disable the error buffer and call something that is not defined in the namespace and see what happens

Drew Verlee22:03:22

In this case, the cursor moved to the error buffer. If i hit q, it moves back to the file, but it's at the top of the ns (far from the expression evaled). This expression, was a symbol that clojure had never seen. One that i evaled directly using cider eval last expression. This isn't something i do often (eval symbols that aren't defined, it happened here bc i assumed the ex of expression had already been hit before (it was a def). I can probably avoid it in this case by evaluating the def (def foo foo) add not just the symbol foo. I'm doing this to debug something. Thanks for reading into this. :) Now that i know why, it's a tiny bit less frustrating...

Drew Verlee21:03:26

if i set cider-show-error-buffer to nil, that works, but it still jumps to the top of the namespace.


From the Cider docs it suggest that only

(setq cider-show-error-buffer nil)
is required to disable the error buffer, so suggest the other variable not be changed (it shouldn't make a difference, but just in case it does something unexpected)

Drew Verlee21:03:38

i guess it's because the error is considered to be an issue compiling the whole namespace?

Unhandled clojure.lang.Compiler$CompilerException
   Error compiling src/centriq_web/property_report.clj at (0:0)

Drew Verlee21:03:00

hmm it's because the symbol isn't defined anywhere. e.g i put a (def foo 1) then revealed foo, but the outer expression never got ran, so ... boom?


Interesting, I found inconsistency in how the cursor behaves when there is an error evaluating Clojure code 1. Calling a function that is not defined will jump to the opening bracket of the call expression, (foo) 2. Calling an evaluated function with incorrect number of arguments does not move the cursor 3. Evaluating a non-existent symbol blahblah jumps to the top of the namespace I assume this is inconsistency in Cider code somewhere. The jump locations were the same regardless of the cider error buffer being enabled.

👀 2