This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-01-26
Channels
- # aleph (9)
- # announcements (31)
- # babashka (23)
- # beginners (35)
- # biff (2)
- # calva (5)
- # cider (10)
- # clara (11)
- # clerk (114)
- # clj-kondo (18)
- # cljdoc (37)
- # clojars (7)
- # clojure (24)
- # clojure-austin (10)
- # clojure-europe (27)
- # clojure-nl (1)
- # clojure-norway (23)
- # clojure-uk (2)
- # clojurescript (18)
- # conjure (2)
- # core-async (6)
- # cursive (21)
- # datomic (3)
- # fulcro (15)
- # introduce-yourself (7)
- # lsp (32)
- # malli (57)
- # meander (5)
- # music (1)
- # nbb (2)
- # off-topic (17)
- # pathom (6)
- # rdf (4)
- # reagent (8)
- # releases (2)
- # shadow-cljs (4)
- # slack-help (23)
- # spacemacs (6)
- # tools-build (32)
How do I tell programmatically if there's a cider connection associated with the current buffer?
I don't mean cider-reply-type-for-buffer
, which will return a type even when we have no associated connection.
(defun cider-connected-p ()
"Return t if CIDER is currently connected, nil otherwise."
(process-live-p (get-buffer-process (cider-current-repl))))
How can I evaluate a Clojure function from EmacsLisp with cider and get its result as a lisp list-of-string (assuming that the Clojure function returns a sequence of Strings) ?
Not sure about cider but I used a elisp package called clomacs
for calling clojure functions in emacs a while ago. It worked pretty well.
The problem can be decomposed into two parts:
• evaluate a clojure expression string, and get a result string back
◦ very easy with CIDER, you can take a look around its eval functions
• use elisp's read
(which clojurists would call read-string
) to turn that string into elisp objects
◦ and cross fingers that one thing can be converted to the other without errors
If you don't want to "cross fingers" so much, change (clojure-eval-string "(foo)")
to (clojure-eval-string "(my.ns/adjust (foo))")
where my.ns/adjust
is a custom function that will make data easier to convert, according to your requirements (e.g. turn sets into lists)
(and where clojure-eval-string
is pseudocode - please look up the actual CIDER functions)
Clomacs might just work, I never tried it. Personally I just like the simplicity of composing a few functions, so that I can understand the whole approach being used
Cross post of Cider / Clerk integration https://clojurians.slack.com/archives/C035GRLJEP8/p1674776078297589