Fork me on GitHub
#cider
<
2023-07-14
>
bozhidar04:07:28

@benjamin.schwerdtner You reminded me that probably for CIDER 2.0 we should make the use of overlays the default and stop printing results in the minibuffer for efficiency’s sake.

😱 2
oyakushev05:07:20

Please, don't take away the minibuffer! 🙂

oyakushev05:07:35

Or do you mean to make it toggleable+disabled by default?

didibus05:07:44

> The visual effect of an overlay is the same as of the corresponding text property (see https://www.gnu.org/software/emacs/manual/html_node/elisp/Text-Properties.html). However, due to a different implementation, overlays generally don’t scale well (many operations take a time that is proportional to the number of overlays in the buffer). If you need to affect the visual appearance of many portions in the buffer, we recommend using text properties. Are they not slow?

Benjamin06:07:07

@U0K064KQV cider eval overlay is only 1 overlay. We are not using it to color the buffer or something which would be a use case for text properties.

bozhidar06:07:55

@U06PNK4HG It's just a matter of what the default setting should be. Now values are printed twice, which seems like a bad default. There are also option to print only in the minibuffer (which was the original behavior) and only in an overlay.

bozhidar06:07:40

One big advantage of printing in the minibuffer is that it's easy to track down previous results, and that's also the default evaluation behaviour for most similar tools in Emacs.

👍 2
hifumi12309:07:35

I dislike output in minibuffer a lot ever since I used CIDER. The text overlay when evaluating is so convenient that every time I return to Common Lisp and use SLY I think "wow I wish this behaved more like CIDER"

❤️ 2
2
Benjamin09:07:16

❤️ cider overlays

hifumi12310:07:49

seriously though, huge thanks to the people who implemented that gratitude

bozhidar11:07:18

I think that was Artur - a fellow Rubyist and a colleague of mine at Toptal. Great engineer!

bozhidar11:07:52

He's also the author of CIDER's debugger.

👏 10
didibus12:07:54

Cider debugger is GOAT

💯 2
enn17:07:55

Is there a way to fully disable the CIDER error buffer? and just see the standard printed stacktrace that Clojure itself generates, with no post-processing (ideally in the REPL)

dpsutton17:07:10

then you can interact with your repl as you like

dpsutton17:07:19

*e, (pst) etc

enn17:07:47

hmm, that doesn’t seem to affect errors thrown during tests

enn17:07:54

which are the main ones I care about

dpsutton17:07:23

what is the behavior like without CIDER? ie in a bare clj repl

dpsutton17:07:33

errors in tests aren’t really bound to *e right?

enn17:07:26

They aren’t bound to *e but I see a helpful, complete stacktrace from a bare clj repl

enn17:07:31

In CIDER I see this:

enn17:07:49

I remember that I used to be able to click on the exception to see a stacktrace (although often the useful parts were hidden; the exception being shown here is the topmost exception, not the underlying cause). But that hasn’t worked in a long time for me. I can’t interact with this at all.

dpsutton17:07:56

that’s CIDER’s custom test runner. What do you see if you run the tests in your repl?

dpsutton17:07:42

i see what you mean. I suspect this would require a lot of surgery, since it’s CIDER’s own test runner

dpsutton17:07:32

i think you’ll have to go code spelunking. m-x nrepl-toggle-message-logging can show you exactly what’s coming over nrepl. If it includes the “normal” output, then you can just change the client code in emacs. If that is already customized you’ll have to go diving into CIDER’s middleware

👍 2
dpsutton17:07:34

I have a handy function that grab’s a test name and sticks it in a register as (clojure.test/run-test <test-name>) and inserts it in the repl. that might be a workflow you would like

dpsutton17:07:50

especially if you stick the namespace on it and use it fully qualified

enn17:07:01

yeah, I was just thinking that’s probably what I want, and then I can just re-bind C-c , t to that

dpsutton17:07:08

exactly what i do

dpsutton17:07:24

i stick it in register i for individual and have (clojure.test/run-tests) in register t

dpsutton17:07:47

(defun personal/set-test ()
  (interactive)
  (if (clojure-top-level-form-p "deftest")
      (save-excursion
        (beginning-of-defun)
        (forward-char 1)
        (clojure-forward-logical-sexp)
        (clojure-forward-logical-sexp)
        (clojure-backward-logical-sexp)
        (set-register ?i (s-concat "(clojure.test/run-test " (thing-at-point 'symbol) ")"))
        (message "set i register to: %s" (get-register ?i)))
    (message "not looking at test")))

thanks3 2
dpsutton17:07:58

is how to wire it up with CIDER to send register contents to the repl

dpsutton17:07:23

note my personal/set-test doesn’t handle metadata on the test name. so you might need to update it to skip over that stuff if needed