emacs

Tomas Brejla 2025-05-15T15:16:06.265389Z

Hi. Is there any "common" package, which would offer similar functionalities such as the new "calva power tools" that recentyly got added to #calva? (https://www.reddit.com/r/Clojure/comments/1kllbw7/introducing_calva_power_tools/) Ie: for example interactive functions for dynamic adding of snitch dependencies & then multiple Stitch-related (instrumentation etc) functions. Or does anyone here have a similar collection of their own functions doing similar stuff?

Tomas Brejla 2025-05-15T15:17:58.673109Z

I must have seen something similar already somewhere, but can't remember where. I guess it would be lovely to have similar set of functions as those in calva power tools, all nicely packed and ready at your fingertips in one package.

2025-05-15T17:10:08.013679Z

Maybe this: https://github.com/practicalli/clojure-cli-config

👍 1
vemv 2025-05-15T17:32:36.280769Z

Best bet would be to dig into the Calva source code, I reckon that it's Clojure code that could be extracted in some way (or even just copied for a quick POC)

vemv 2025-05-15T17:35:34.982869Z

Either way, you can use those tools and then some more via Emacs and/or cider, clojure-lsp specifically I haven't tried these "power tools", but in the end it boils down to: • the tools themselves (you already have them) • a nice UI for a command palette (can be achieved, for instance clj-refactor uses Hydra, and clojure-lsp uses lsp customs)

pez 2025-05-15T17:55:34.582609Z

It’s very little code involved. https://github.com/BetterThanTomorrow/calva-power-tools

Ovi Stoica 2025-05-16T09:08:44.890189Z

In this visual tools demo, in the first presentation https://www.youtube.com/watch?v=2VOXxG_7VGk&t=28s @mb presented a tool he’s made for transient commands with cider, one of them was adding snitch to runtime. It is a good starting point. He made this emacs package for it: https://github.com/licht1stein/context-transient.el I’d love this thread to evolve into a ready made power tools version for emacs Hope this helps!

Tomas Brejla 2025-05-16T09:29:17.709899Z

@ovi_b that must be the I must have seen something similar already video. Thank you! context-transient.el seems like a nice "housing" for similar features that calva-power-tools offers.

Tomas Brejla 2025-05-16T09:29:40.257019Z

> I'd love this thread to evolve into a more polished version for emacs Same.

pez 2025-05-16T09:32:42.140609Z

The UI looks polished to me. 😃

1
pez 2025-05-16T09:33:56.931949Z

Regarding requiring Snitch, it only needs to be done once for a repl session. Calva Power Tools does it as part of loading the dependency and doesn’t have a separate command for it. May not be the optimal way to do it, but just noting.

Ovi Stoica 2025-05-16T09:35:03.480249Z

By polished I meant, using context-transient.el to have a set of ready made tools like calva power tools. The transient menu is great imo

licht1stein 2025-05-16T09:35:43.563949Z

Thank you! I never needed anything else from it, so the UI is ok. Requiring snitch is just a command, like many others, and is very useful when debugging prod. But I would not want it to automatically be required every time I connect to the prod repl.

pez 2025-05-16T09:37:23.988949Z

Me neither! Not in dev either.

licht1stein 2025-05-16T09:38:19.057899Z

Saying that there’s nothing stopping you from adding it to some sort of a custom jack-in command, but it seems pressing something like F7 t s once per dev session is not too much work 🙃

licht1stein 2025-05-16T09:39:02.823499Z

I also have a command to remove all snitch forms in a buffer.

pez 2025-05-16T09:39:28.213499Z

Calva Power Tools has a command for loading the Snitch dependency. And does require as part of that.

licht1stein 2025-05-16T09:40:25.930979Z

Sure, you can implement anything like that with context-transient’s defclj macro

Ovi Stoica 2025-05-16T09:40:31.861899Z

This is awesome and I don’t I need more haha

❤️ 3
1
pez 2025-05-16T09:43:30.355489Z

I wish VS Code was dynamic like that. 😍

licht1stein 2025-05-16T09:43:50.635149Z

Emacs is the way 🌌

1
licht1stein 2025-05-16T09:46:13.575029Z

Here’s one more for you @ovidiu.stoica1094

(defun clj-remove-snitches ()
    "Remove all snitch tools from buffer."
    (interactive)
    (save-excursion
      (goto-char (point-min))
      (while (re-search-forward (regexp-opt '("defn*" "*let" "*fn" "defmethod*")) nil t)
        (replace-match (replace-regexp-in-string "*" "" (match-string 0)) nil nil))
      (goto-char (point-min))
      (while (re-search-forward (regexp-opt '("#p ")) nil t)
        (replace-match ""))))

🚀 1