Trouble setting up Figwheel REPL within CIDER

824 views Asked by At

I just started playing around with making a simple cljs app using the following template:

lein new figwheel someproject -- --reagent

I was hoping to use the REPL in cider for cljs development the same way I typically would for a normal clj project, so I did some research and ended up here:

https://github.com/bhauman/lein-figwheel/wiki/Using-the-Figwheel-REPL-within-NRepl

I read through the instructions, and verified that all the proper dependencies are in project.clj (didn't have to change anything, looks like the template added everything I would need). The final step in the above link indicates I would need to add the following code to my emacs config:

(require 'cider)
(setq cider-cljs-lein-repl
      "(do (require 'figwheel-sidecar.repl-api)
           (figwheel-sidecar.repl-api/start-figwheel!)
           (figwheel-sidecar.repl-api/cljs-repl))")

Now - I'm an emacs newb, so the setup I'm using is still the one I first learned on from "Clojure for the Brave and True":

https://github.com/flyingmachine/emacs-for-clojure

I tried to first put the above snippet in ~/.emacs.d/init.el, but whenever I attempt M-x cider-jack-in ..., there is no cider-jack-in-clojurescript option. I also tried putting the snippet in the ~/.emacs.d/customizations/setup-clojure.el, which seemed like a more logical home, but same result.

I'd really love to be able to get this REPL up and running, so any help would be appreciated.

1

There are 1 answers

2
Juraj Martinka On

I usually use plain cider-jack-in and then call everything from REPL:

(use 'figwheel-sidecar.repl-api)
(start-figwheel!)
(cljs-repl)

If you want to have two repls, you can do the final step (cljs-repl) in separate REPL opened via cider-connect.

If you are just starting with Emacs, I believe your best bet is Spacemacs: http://spacemacs.org/. If you are interested, I did a blog post and a video about my dev workflow.