-
-
Notifications
You must be signed in to change notification settings - Fork 207
Running figwheel with Emacs Inferior Clojure Interaction Mode
inf-clojure allows you to interact with a terminal Clojure/ClojureScript REPL directly within Emacs. This enables you to ship code from your buffer to the ClojureScript REPL for evaluation and much more. The main advantage of using inf-clojure is that you have extremely simple direct access to a Clojure(Script) REPL from Emacs and can skip the complexity and configuration involved in getting nREPL to work for ClojureScript.
Assuming you have already installed clojure-mode, run M-x package-list-packages and install inf-clojure.
Edit your .emacs or init.el and add a function like the following:
(defun figwheel-repl ()
(interactive)
(inf-clojure "lein figwheel"))
(add-hook 'clojure-mode-hook #'inf-clojure-minor-mode)Restart Emacs (or evaluate the forms above with C-x C-e)!
Open your ClojureScript file and run M-x figwheel-repl. You'll get a new buffer with the REPL. Switch back to your file.
-
C-c C-lwill load the file. -
C-c Meta-nwill switch your namespace. - If you place your cursor at the end of a s-expression,
C-x C-ewill evaluate that expression. -
C-c C-vwill show the docs.C-c C-swill show the source.C-c <return>will macroexpand.
Refer to inf-clojure for more documentation.
You are done!
Create a script/repl.clj with the following contents:
(use 'figwheel-sidecar.repl-api)
(start-figwheel!)
(cljs-repl)note: leiningen profile merging won't occur with start-figwheel!
Edit your .emacs or init.el and add a function like the following if you are using the JAR in your current directory:
(defun figwheel-repl ()
(interactive)
(inf-clojure "lein trampoline run -m clojure.main script/repl.clj"))
(add-hook 'clojure-mode-hook #'inf-clojure-minor-mode)Open your ClojureScript file and run M-x figwheel-repl. You'll get a new buffer with the REPL.