Increasingly Functional.
by Joshua Miller | on Twitter | on the web | on github

My Swank/Clojure Setup

May 18th 2010

Tagged: clojure

This is one of those things that is simple, but only if you know where to look for it. There are a ton of emacs/clojure setup articles on the greater www, but many of them are out of date, and some of them are being explicitly deprecated.

First, you need to install slime via elpa. I recommend using the emacs starter kit, then M-x package-install RET slime RET.

I've found that most things I want to work with are set up and distributed with leiningen, so I use it too. In a new project, (lein new), or a cloned one, add the the following to your project.clj:

:dev-dependencies [[leiningen/lein-swank "1.1.0"]]

Then run (from your project root):

 lein deps

That'll pull down the lein-swank plugin. Next:

 lein swank

That'll start the swank server with all your leiningen-defined dependencies for your project. From within emacs:

 M-x slime-connect

Accept the host (127.0.0.1) and port (4005), and emacs will connect to the slime server leiningen started, and you'll be ready to go.