I don’t think we need more help with this particular issue, but there are always other issues one can tackle. 😄
I really need to do that. Let me see what I can find.
what is the cider command that lets me evaluate a function under the point in the minibuffer, supplying arguments?
or an equivalent.
I’m constantly typing out functions in my buffer with arguments so I can evaluate them then deleting them. So, if I made
(defn foobar [x]
(* 2 x))
I would then write
(foobar 8)
below it and run a cider eval on it, then delete it.
Alternately I suppose I could copy paste it into the repl, but that would take as much time.aha, found it: cider-read-and-eval-defun-at-point
I remember now. I also remember I was getting errors and that’s why I had stopped using it and thus forgotten it.
I’ll put the error in a thread…
@qythium thanks!
when running cider-read-and-eval-defun-at-point
on
(defn foobar [x]
(* 2 x))
I get
Show: Project-Only All
Hide: Clojure Java REPL Tooling Duplicates (24 frames hidden)
2. Unhandled clojure.lang.Compiler$CompilerException
Error compiling *cider-repl past/someproject:localhost:3333(clj)* at (1:1)
#:clojure.error{:phase :compile-syntax-check,
:line 1,
:column 1,
:source
"*cider-repl past/someproject:localhost:3333(clj)*"}
1. Caused by java.lang.RuntimeException
Unable to resolve symbol: foobar in this context
Util.java: 221 clojure.lang.Util/runtimeException
core.clj: 3214 clojure.core/eval
core.clj: 3210 clojure.core/eval
main.clj: 437 clojure.main/repl/read-eval-print/fn
main.clj: 458 clojure.main/repl/fn
main.clj: 368 clojure.main/repl
RestFn.java: 1523 clojure.lang.RestFn/invoke
AFn.java: 22 clojure.lang.AFn/run
AFn.java: 22 clojure.lang.AFn/run
Thread.java: 748 java.lang.Thread/run
cider-eval-defun-at-point
works fine, however.
to define the function in the buffer, that is.
This is a cljs file in a Reagent project, by the way, running in a browser.
I then delete it.
I do this with most functions I define, so dozens of times a day. Probably my doing this is the result of a bad approach… not sure.