Fork me on GitHub
#cider
<
2020-10-30
>
timsgardner00:10:57

Hey, I couldn't easily find a satisfactory solution to this googling. In emacs I'm trying to use babel to send forms to the cider repl. When I enter a clojure code block and run cider-eval-last-sexp, cider-eval-last-sexp-to-repl, cider-eval-defun-at-point, etc, nothing happens, not even an error message. These commands work as expected in a clojure file. Does anyone know how to get this working? Thanks

timsgardner07:10:53

thanks that looks like it's working!

timsgardner07:10:00

I wish everything in emacs didn't require hours of googling, obsolete docs, source spelunking 😕

timsgardner07:10:16

you saved me a lot of time, thanks again

👍 3
nivekuil07:10:12

In reply to @￱￱slack￱￱￱￱￱￱t03￱￱r￱￱z￱￱g￱￱p￱￱f￱￱r=2d￱￱u3￱￱q8￱￱m￱￱m￱￱r￱￱e￱_￱x:nivekuil.comyou saved me a lot of time, thanks againover time you get an intuition for things :) is there anything you can think of that would have made the org-mode <-> cider connection requirements clearer?

timsgardner07:10:44

Thanks for asking, I'm composing a medium doc now. The problem here was that it involved triangulating many different libraries, some of which are obsolete, the docs for each of which assume familiarity with another library. It's also completely possible there's a compact recipe for this somewhere and I didn't find it.

timsgardner07:10:55

The org docs for ob-clojure are extremely vague about how to connect a session and get fully set up for source block evaluation. The github README for ob-clojure-literate is outdated because ob-clojure-literate was integrated into org contrib two years ago. I could not find a fully explicit account of how to get access to org contrib libraries that actually worked for me, instead I pieced together from examining package-list-packages and a stack overflow post that a package called org-plus-contrib is relevant. With some trepidation, since this sort of thing can subtly screw up emacs sometimes, I installed it, taking care to require it before using other org functions (a poster on stack overflow recommended this). The commands ran but didn't work correctly. Looking inside the ob-clojure-literate source, I found much depends on the presence of cider-connections. By trial and error I found this function has a non-null return in a clojure source file while cider is active but not in the source block buffer. After reading the ob-clojure-literate source some more I checked slack again and got your very welcome answer. Through more trial and error I pieced together that sesman-link-with-buffer expects to be given the name of sessions as provided in the top line of each entry in sesman-browser. That worked.

timsgardner07:10:24

This sort of thing is probably inherently difficult to document because there are many moving parts

bozhidar18:11:14

I think ob-clojure didn't keep up with recent CIDER developments and this caused a lot of confusion in the end.

bozhidar18:11:32

I don't use it myself, that's why I don't follow its development closely.

Jim Newton12:10:05

how can I re-indent all the lines in a file using cider? I've done a search/replace on some function names, now many lines are not indented correctly.

nivekuil22:10:00

In reply to @￱￱slack￱￱￱￱￱￱t03￱￱r￱￱z￱￱g￱￱p￱￱f￱￱r=2d￱￱u010￱￱v￱￱p3￱￱u￱￱y9￱￱x:nivekuil.comhow can I re-indent all the lines in a file using cider? I've done a search/replace on some function names, now many lines are not indented correctly.there's also aggressive indent mode which automatically formats as you go

Jim Newton12:10:30

Answering my own question. I found indent-region I was looking for reindent and not finding anything useful

Louis Kottmann17:10:28

C-x h <tab> should do the trick

Eric Ihli18:10:30

Is there something about how Cider evaluates things that would cause the following behavior? I define a function,

(ns integrant.repl)
(defn suspend []
  (println state/system)
  (when state/system (ig/suspend! state/system))
  :suspended)
If I run that from my REPL in Emacs, it works find. When I set cider-ns-refresh-after-fn to integrant.repl/suspend, I don't get that println at the REPL or to the Messages buffer