Skip to content
Omar Hughes edited this page Dec 10, 2015 · 20 revisions

When using Cider you want your REPL to use Cider's middlewares so stack traces in Emacs are nicely formatted, etc. (You'll need to use the latest Cider, rather than 0.8.2 stable.) Here's how to do it:

  1. Make sure your version of boot is recent by running boot -u.**

  2. Make your $BOOT_HOME/profile.boot or build.boot look like the following. $BOOT_HOME/profile.boot is preferred so that you don't force other people to default to Cider, even though they really should.

    (require 'boot.repl)
    (swap! boot.repl/*default-dependencies*
           concat '[[cider/cider-nrepl "0.10.0"]
                    [refactor-nrepl "2.0.0-SNAPSHOT"]])
    
    (swap! boot.repl/*default-middleware*
           conj 'cider.nrepl/cider-middleware)

    NOTE: Make sure to have an ' (apostrophe) before [[cider/cider-nrepl "0.10.0"]]. (If it's not shown here that means Github's syntax highlighting is still broken.)

  3. Run REPL as usual with boot repl.

Adding clj-refactor works the same way, just add [refactor-nrepl "VERSION-HERE"] and refactor-nrepl.middleware/wrap-refactor respectively.

You can find more documentation in commit 1a765793:

Expose repl task dependencies

The repl task is special because it can't run in a pod. It needs to
run in the project context and have access to the environment of the
build.boot script.

In order to keep the project classpath pristine when the REPL is not in
use, the nREPL dependencies are not loaded until the repl task actually
needs to run. This presents difficulties with middleware, since most of
these are in namespaces that assume tools.nrepl is available.

To support middlware in this environment we expose two atoms:

- boot.repl/*default-dependencies* atom containing a vector of maven
  coordinates in the (set-env! :dependencies '[...]) format. These
  dependencies will be added only when the repl task is run, and only if
  the project does not already have explicit dependencies for the deps
  it would otherwise load.

- boot.repl/*default-middleware* atom containing a vector of namespace
  qualified symbols corresponding to desired middleware. The repl task
  will resolve them at runtime as necessary, so they don't need to be
  resolvable from the build.boot.

Modify these to change dependencies or middleware loaded by default by
the repl task. The middleware option to the repl task adds middleware in
addition to these defaults. The handler option will override these.
Clone this wiki locally