Fork me on GitHub
#cider
<
2018-11-02
>
narendraj952108:11:02

How can I cider-connect to a nREPL started with lein cljsbuild? cider doesn't seem to have a nREPL type for it.

bozhidar08:11:42

@narendraj9521 I thought this was some ancient legacy. 🙂 I guess you can add some custom type for it http://www.cider.mx/en/latest/clojurescript/#starting-a-clojurescript-repl

narendraj952108:11:31

I was having some issues with cider-jack-in-cljs. Since I am not fully familiar with what it does behind the scenes, I was looking at other options.

bozhidar08:11:36

If you start the nREPL server outside Emacs you can simply connect to it via cider-connect.

bozhidar08:11:02

I simply don’t know what cljsbuild does - I just have a passing familiarity with figwheel and shadow.

narendraj952108:11:35

I don't need to call cider-connect-cljs for that?

narendraj952108:11:10

How do you build your ClojureScript application for production?

bozhidar08:11:34

I’m don’t ClojureScript, only Clojure. My knowledge of ClojureScript extends just to the bare minimum for me to implement support for it in CIDER. Can’t help with pro cljs advice. 🙂

narendraj952108:11:01

I am also new to Clojurescript. Looks like it's not as seamless to use cider with ClojureScript as it is with Clojure. I have mostly written Clojure.

dpsutton15:11:10

@narendraj9521 that's true, it is unfortunatley not as seamless. I would grab a figwheel main tutorial or template or a shadow-cljs tutorial or template and work from there.

narendraj952115:11:55

Yes, it's difficult to add things to an existing project.

martinklepsch17:11:26

I either asked this recently or I meant to — how can I bind a clojure form to a command that will be sent to the current nREPL connection?

bozhidar17:11:27

@martinklepsch Can you show me some example of what you’re trying to do? You just want to wrap some expression to an interactive Emacs command, right?

martinklepsch17:11:03

@bozhidar I want to run something like (integrant.repl/reset) with a command that I can access via M-x (I think that is interactive, right?)

bozhidar17:11:00

Let me write a snippet for you.

martinklepsch17:11:24

Thanks a lot Bozhidar, much appreciated ❤️

bozhidar17:11:50

(defun cider-ns-reload-all (&optional prompt)
  (interactive "P")
  (let ((ns (if prompt
                (string-remove-prefix "'" (read-from-minibuffer "Namespace: " (clojure-find-ns)))
              (clojure-find-ns))))
    (cider-interactive-eval (format "(require '%s :reload-all)" ns))))

bozhidar17:11:09

That’s an actual command in CIDER that does exactly the type of thing you want.

bozhidar17:11:32

cider-interactive-eval is the meat of the command.

bozhidar17:11:57

And in your case without any args it will just (interactive) without “P”.

martinklepsch17:11:20

(defun integrant-halt-go ()
  (interactive)
  (cider-interactive-eval "(do (integrant.repl/halt) (integrant.repl/go))"))
Thanks, this is perfect 👌

dpsutton17:11:12

if you use hydras you could probably make a nice interactive menu