Emacs and Inferior Clojure Interaction Mode

Emacs and Inferior Clojure Interaction Mode

This guide requires ClojureScript 1.10.238 or later and assumes familiarity with the Quick Start.

Assuming you already have clojure-mode, run M-x package-list-packages and install inf-clojure. If you are using Emacs on OS X be sure to install exec-path-from-shell so that the Node.js REPL will work correctly. If you need exec-path-from-shell make sure to follow the Usage instructions.

Edit your .emacs or init.el and add a function like the following if you are using the JAR in your current directory:

(defun cljs-node-repl ()
  (inf-clojure "clj -M -m cljs.main -co build.edn -re node -r"))

Open your ClojureScript file and run M-x cljs-node-repl. You’ll get a new buffer with the REPL. Switch back to your file and run M-x inf-clojure-minor-mode. C-c C-l will load the file. C-c Meta-n will switch your namespace. If you place your cursor at the end of a s-expression, C-x C-e will evaluate that expression. C-c C-v will show the docs. C-c C-s will show the source. C-c <return> will macroexpand. Refer to inf-clojure for more documentation.