Fork me on GitHub
#cider
<
2024-02-29
>
Drew Verlee05:02:57

when i do a cider-inspect it sometimes brings my cursor from where it was, to the top of the currently file. As you can see in this video:

Drew Verlee05:02:01

My only guess is that it's related to trying to bring the cursor to the top of the cider inspect buffer.

vemv07:02:17

I think I get what you're saying although I can't see it (I'm used to a larger font) Feel free to create an issue

Drew Verlee20:03:36

This only (cider inspect last sexp not opening a new buffer but putting the cursor at the top of the current screen) happens on my main computer (operating system is ubuntu) and not my mac. Same emacs.d and spacemacs init file, i installed emacs a different way though. I wish it was easier for me to re-install emacs, but i did a native compile this timei and i'm even less sure how to mess with it now 🙂 .

vemv21:03:34

It might be some sort of race condition? That might make sense given the OS difference

dergutemoritz09:02:49

I have a question regarding clj-refactor (hope this is the right place to ask): clean-ns will wrap around requires when they exceed a certain line length. Can this length be configured somewhere?

vemv10:02:37

There's (defcustom cljr-print-right-margin 72 and (defcustom cljr-print-miser-width 40

dergutemoritz10:02:58

Ah, great, thanks!

dergutemoritz10:02:37

While trying this out just now I noticed that clean-ns will only reformat if it had something else to clean up as well.

dergutemoritz10:02:09

So I had to swap some entries to make it sort them again and only then it would also apply the new formatting

dergutemoritz10:02:23

Could be considered a bug? If so, I can file a ticket

vemv10:02:58

I see, that happens because refactor-nrepl handles the ns form as a traditional data structure (unaware of whitespace). Probably we don't refactor that, particularly as there's a variety of formatters for the ns form

vemv10:02:45

I use refactor-nrepl and how-to-ns from the repl Another effective stack is clojure-lsp used as a cli tool

dergutemoritz10:02:06

Hm I don't follow - are you saying that the reformatting isn't applied by refactor-nrepl but by something else? I only have cider, clojure-mode and clj-refactor enabled

vemv11:02:56

clj-refactor uses refactor-nrepl (just like cider uses cider-nrepl) so in refactor-nrepl, that Clojure code just sees a data representation of your ns, so if what's to be fixed is whitespace only, it can't see it and nothing will be fixed

vemv11:02:26

We could introduce an option for refactor-nrepl to always return something, maybe comparing with equal Elisp-side for avoiding a useless replacement. Doesn't sound like a lot of work - would you be interested in a PR?

dergutemoritz11:02:12

Right, that's what I was thinking! So does the replacement (and thus reformatting) of the form happen in clj-refactor then? And the issue is that refactor-nrepl just doesn't hand us anything back since it doesn't detect any structural changes?

dergutemoritz11:02:28

I can give a PR a shot, yep

vemv11:02:20

Yep, exactly, refactor-nrepl returns nil when no changes detected So refactor-nrepl should listen to a new option (avoiding the breaking api change). It would be fine for clj-refactor to always pass that option - no defcustom needed Thanks!