5

I'm editing a ClojureScript file, and I have a working ClojureScript REPL in another buffer. But when I try to evaluate a form in my file ui.cljs, with C-c C-c, I get a beep an a message in the mini-buffer that says

No cljs REPLs in current session "MyProjectDir/MyProject:localhost:59437

I don't really understand what that means, but it appears that my ui.cljs file got associated with the wrong REPL - the Clojure REPL, not the CLJS REPL.

CIDER Sessions:

1: MyProjectDir/MyProject:localhost:59437  
    linked-to: buf(ui.cljs)  
      objects: *cider-repl %s(clj)*  

2: MyProjectDir/MyProject:localhost:60016
    linked-to: >proj(~/Workspace/MyProjectDir/MyProject/)  
      objects: *cider-repl %s(cljs:weasel)*  

I try to "unlink" it by running the sesman-unlink command in the ui.cljs buffer. But I only get a beep and a cryptic error message in the minibuffer:

Wrong type argument: stringp, #<buffer ui.cljs>

How to associate that ui.cljs file/buffer with the correct REPL?

Emacs 25.3.1 on macOS. CIDER 0.19.0

3
  • How did you start the repl? can you hop between repl and cljs buffer with C-c C-z? Commented Jan 27, 2019 at 7:16
  • Cider has the command cider-connect-sibling-cljs and cider-connect-sibling-clj that you can M-x in the repl that you want to connect, however I recommend you look at your workflow altogether and use something like figwheel or shadow-cljs, I can post the way to get it started here if you require so. Commented Jan 27, 2019 at 7:21
  • I started 2 REPLs, one with cider-jack-in and the other with cider-jack-in-cljs, and weasel to the first question it asks. It was working well for a while. When it broke, C-c C-z was also failing. It seems to have lost the connection between the two and I couldn't recreate it. I don't get sesman-unlink. When I have a buffer "linked" it doesn't offer an option to unlink it.
    – Rob N
    Commented Jan 27, 2019 at 14:21

1 Answer 1

1

There is a detailed comparison of the different cljs repls to date in lambdaisland

Borrowing from this rich and reputable source here is the bits of code you need to have configured for running weasel:

Server (Clojure)

(cljs.repl/repl (weasel.repl.websocket/repl-env :ip "0.0.0.0" :port 9001))

Client (ClojureScript)

(ns main
  (:require [weasel.repl :as repl]))

(when-not (repl/alive?)
  (repl/connect "ws://localhost:9001"))

I do recommend using figwheel repl. Here is a video (also by Arne of LambdaIsland) going through the configuration for Figwheel with Cider: link to youtube

Alternatively shadow-cljs is a different approach complete solution that's easy to configure, repl and all.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.