This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-10-04
Channels
- # announcements (6)
- # babashka (7)
- # beginners (2)
- # biff (5)
- # calva (2)
- # cherry (17)
- # cider (3)
- # clj-kondo (8)
- # clojure (202)
- # clojure-brasil (8)
- # clojure-europe (20)
- # clojure-norway (23)
- # clojure-uk (4)
- # clojuredesign-podcast (5)
- # conjure (1)
- # cursive (9)
- # eastwood (22)
- # events (8)
- # fulcro (3)
- # hyperfiddle (22)
- # introduce-yourself (7)
- # lsp (67)
- # malli (1)
- # matrix (1)
- # meander (6)
- # off-topic (76)
- # pedestal (8)
- # polylith (17)
- # quil (12)
- # re-frame (2)
- # reagent (8)
- # releases (3)
- # shadow-cljs (67)
- # sql (93)
- # squint (39)
- # tools-deps (46)
- # vim (7)
I started using a calva fiddles for key bindings to my test files. But then I realized that I could just use one fiddle file. Now I realize that all I want to do in the key binding is call a function but have it act like I called it from the current file. That's what the fiddle is doing for me effectively. So I have a bunch of bindings that look like:
{ "key": "ctrl+t",
"when": "calva:connected",
"command": "runCommands",
"args": {
"commands": [
{ "command": "calva.runCustomREPLCommand",
"args": "(intern 'user 'opts \":x :y :z\")" },
{ "command": "calva.evaluateFiddleForSourceFile" } ] } },
with a fiddle.clj
like:
(eval (read-string (str "(my.test.ns/run " user/opts ")")))
when something like this seems more simple and powerful:
{ "key": "ctrl+t",
"when": "calva:connected",
"command": "calva.runCustomREPLCommand",
"args": "(my.test.ns/run :x :y :z)" }
but my.test.run/run
is a macro that uses *ns*
which is bound to the current ns, which without the fiddle is user
and I want it to be the ns of the current file I'm editting.
If there was a var that held the currently editing ns, I think I could do this. Is there?That’ll be $editor-ns
. See https://calva.io/custom-commands/ for all the substitution variables available.
❤️ 1