Using Emacs+CIDER

Given that Emacs with CIDER is a commonly used setup for developing in Clojure, I want to leave this here for people searching for how to use it with Exercism.

  1. Start the Clojure process via (apart from the cider and nrepl ceremony, note the inclusion of the “test” directory in :paths):
clj -Sdeps '{:deps {nrepl/nrepl {:mvn/version "1.1.0"}
                    cider/cider-nrepl {:mvn/version "0.58.0"}}
             :paths ["src" "test"]}' \
    -M -m nrepl.cmdline \
    --middleware "[cider.nrepl/cider-middleware]"
  1. (cider-connect) to the localhost:$PORT corresponding to the process started in 1.
  2. (cider-load-all-project-ns) now also loads the “*-test” namespace.
  3. (cider-test-run-ns-tests) in the src/$EXERCISE.clj implementation buffer to run the tests.
4 Likes