leiningen, clojure 1.2 and emacs

I had a bit of a struggle today.

I was trying to have a play with defrecord in clojure 1.2 in preparation for the May dojo. This meant that I needed to move up to clojure 1.2 as defrecord is new functionality. After much flailing, some help from technomancy and tcrayford on irc (Thanks!) I was able to get something up and running. Here is what works.

The most basic project.clj for this is:

(defproject my-proj "0.0.1"
:description "The simplest clojure 1.2 project.clj possible for emacs"
:dependencies [[org.clojure/clojure "1.2.0-master-SNAPSHOT"]
[org.clojure/clojure-contrib "1.2.0-SNAPSHOT"]]
:dev-dependencies [[swank-clojure "1.2.0"]]
:repositories {"clojure-releases" "http://build.clojure.org/releases"})

This is enough to get lein swank up and running. However, now clojure-test-mode won’t work. The version is elpa isn’t new enough (you are using elpa and emacs-starter-kit aren’t you?) so we need to get it from technomancy’s github.

Find a nice directory to keep the code and do the following:

$ git clone http://github.com/technomancy/clojure-mode.git

Then open up emacs and open the cloned clojure-mode.el file and type M-x package-install-from-buffer. Then do the same for clojure-test-mode.el. Now everything should work. You should be able to start lein swank from the command line and then connect to it using M-x slime-connect and do things like run the test cases using C-c , and do things like slime-who-calls (and make tcrayford happy.

Soon these versions should be in elpa and so you won’t need these instructions any more.


2 thoughts on “leiningen, clojure 1.2 and emacs

  1. I’m still not entirely happy with it. I’m getting some weird stack traces from lein test, but it is at least working.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s