Starting Figwheel in Emacs


This post is over 2 years old. A lot has changed since then! Take these words with a grain of salt and some patience with past me, who no longer exists.

When I use Emacs to write ClojureScript, I often jack in to CIDER just to start Figwheel and get to the ClojureScript REPL. After running M-x cider-jack-in, I would type in the REPL:

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

Turns out, there's a faster way to do this using the cider-cljs-lein-repl variable. Add the following to your Emacs config:1

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

Now, when I'm in a ClojureScript project, I run M-x cider-jack-in-clojurescript instead of M-x cider-jack-in. The value of cider-cljs-lein-repl is used to start the ClojureScript REPL, so figwheel starts automatically and puts me right into the cljs REPL. Magic!

  1. I put this in the :config block of a use-package declaration for CIDER, if you're into that sort of thing.