cider

teodorlu 2025-07-08T11:23:42.622029Z

good morning 🙂 Any advice on getting the result of a cider-interactive-eval as a string that I can further parse with eg parseedn-parse-str? I tried the following, but it appears cider-interactive-eval doesn't return a string.

(defun demo ()
  (interactive)
  (let* ((edn-str (cider-interactive-eval "(map (partial * 10) '(1 2 3))"))
         (elisp-values (parseedn-read-str edn-str)))
    elisp-values))
;; then M-x demo from a buffer with a running REPL.

✅ 1
teodorlu 2025-07-08T11:23:50.290599Z

(The idea is to use completing-read to select one of the elisp values, and then do further REPL incantations with that)

teodorlu 2025-07-08T11:24:07.382609Z

Originally posted in #emacs, but moved here. https://clojurians.slack.com/archives/C099W16KZ/p1751973522823009

teodorlu 2025-07-08T11:59:48.795949Z

I think maybe I could use callback.

(defun cider-interactive-eval (form &optional callback bounds additional-params)
  "Evaluate FORM and dispatch the response to CALLBACK.
If the code to be evaluated comes from a buffer, it is preferred to use a
nil FORM, and specify the code via the BOUNDS argument instead.
...

oyakushev 2025-07-08T12:32:15.149379Z

Either callback, or check cider-nrepl-send-sync-request

👀 1
teodorlu 2025-07-08T12:38:22.534449Z

Great — thank you! 🙏

Charles Comstock 2025-07-11T07:03:59.884939Z

I have a few hacks where I use the callback to paste it into a buffer to format results using an elisp mode: https://github.com/dgtized/dotfiles/blob/master/site-lisp/clgc-clojure.el#L1. Specifically look at how clj-dissasemble and clj-decompile emit cider eval results into a popup buffer to apply transformations on. I suspect what you want instead is to put your edn parsing in something like the clj-combined-popup-eval-handler I have as a callback with clj-decompile-render. The main thing to remember is that cider-interactive-eval is an async call that may take a while to return, so you don't want emacs to block, so you definitely need a callback to receive the result. For little evaluations like you suggested the sync handler mentioned may work, but careful if it blocks the emacs UI.

💯 1
👀 1
cch1 2025-07-08T23:30:27.246359Z

I'm struggling to get a basic ClojureScript REPL working with node because of https://github.com/clojure-emacs/cider/issues/3781 problem. Does anybody have any advice? In order of things I would be happy to give up.... 1. Version of node 2. Version of Clojure 3. Version of cider ecosystem deps 4. Version of ClojureScript 5. Version of CIDER 6. Version of emacs It's been a while since I worked in ClojureScript, so maybe I'm just doing it wrong, but this problem is debilitating.

Harold 2025-07-09T01:16:35.377999Z

That's my issue, and I'd for sure like to see it resolved. fwiw, we've worked around it currently by doubling down on #shadow-cljs, which, for the most part, works great with cider. Our biggest outstanding issue is this one: https://github.com/clojure-emacs/cider/issues/3597 which I'm almost but not quite smart enough to fix, but I am learning things every day 🙂

Harold 2025-07-09T01:18:34.591389Z

--- David's recent talk: https://www.youtube.com/watch?v=An-ImWVppNQ pops off about the benefits of cljs with fewer layers of tooling, and I do think it'd be great to have everything he's excited about working in Cider.

cch1 2025-07-09T02:33:49.628239Z

Thanks for the quick reply, Harold. I saw David's talk and was intrigued. I've been away from ClojureScript for the past couple of years, but I'm dabbling again.

Harold 2025-07-09T02:42:01.055849Z

yeah, it's interesting, when I logged that issue I was thinking about some of the same things from that talk (these ideas are in the air), but for real work, shadow-cljs is serving us well (better than I thought it would).