How do you install Clojure with SLIME/Emacs support? The answer is either really easy or really hard, depending.

Easy!

If you're new to Clojure and want to get it working fast, you are in luck. Go to swank-clojure's home on github and follow the directions to install it via ELPA. This is very easy and fast and it works.

If you want more documentation, there is (thankfully) a single, central, official-ish location where documentation for installing Clojure is slowly but surely accumulating. You can read about it at http://www.assembla.com/wiki/show/clojure/Getting_Started. This site includes instructions for Emacs, Netbeans, Eclipse, Maven, and everything else under the sun. This is a great resource, and attempts to solve the problem of out-of-date Clojure documentation. (This problem is natural given Clojure's young age and rapid growth, but it's painful for people trying to get started, I bet.)

Or is it...

This is all great. But if you want to do anything non-standard, you run into a bit of a wall. How do you install Clojure+SLIME on Windows? I find that sometimes it works, but sometimes things mysteriously fail, and I have no idea where even to begin to debug it, because there's so much automation going on in the background nowadays. What if you want to build a .emacs.d directory you can simply copy from one system to another and have everything work? (You can do this with most Emacs libs.)

Or how do you install and use a bleeding-edge Clojure or clojure-contrib tree with SLIME? There's good reason to want to, because it has some awesome new features, e.g. deftypes and protocols and rest-parameter destructuring. But most of the "official" methods of installing things give you stable versions of everything.

And then, you generally end up with a bunch of opaque .jar files, auto-downloaded all over your system, which isn't helpful if you want to hack on anything yourself. Most of these jars end up in ~/.m2 nowadays, I think? Used to be ~/.swank-clojure or ~/.clojure or something? And ~/.emacs.d/elpa gets stuff too? Color me continually confused.

The automated build tools we have nowadays (ELPA, Lein, Maven) are awesome when they work, but extremely painful when they fail or when you don't know which knobs to turn when you want to step slightly outside of the mainstream. This is incidental complexity if I ever saw it. While it's far more manual labor, I find it to be so much simpler to download things myself, build everything myself, put it all somewhere on my system myself, and configure Emacs to tell it where to find everything.

Well, this site is as close as I can find to good up-to-date documentation, and what I did to get set up was almost identical to this. But it will likely stop working in a month or two. There's also a recent thread on the Clojure mailing list which has some more tips (and valid complaints).

I will push my Emacs setup to my github repo once I get the kinks worked out. But if you want to get bleeding-edge everything working yourself, all I have to say is God help you, because it's largely unsupported. Be prepared to hack and patch until it works. I'm looking forward to the day when most of the kinks are worked out and things settle down a bit.

7 Comments

It would be helpful if there was a central place editable by anyone were documentation could be contributed. There is the wikibooks site but that's geared towards more formal book-like contributions. The assembla wiki seems to be restricted.

Maybe an official wiki is needed?

Quoth Brian on April 14, 2010 @ 11:01 AM PDT

There are a ton of places for documentation, but a lot of them are abandoned. I think a lot of people can access assembla, it seems like an OK place.

Quoth Glen Stampoultzis on April 14, 2010 @ 11:49 AM PDT

The fact that all this documentation is spread out is a big usability problem. The information is out there but it's hard to find sometimes.

I see that various people have contributed to assembla but my login doesn't seem to have permission. Is it supposed to be open to anyone or just a select few?

Quoth Brian on April 14, 2010 @ 11:54 AM PDT

Everyone who sent Rich a Contributor Agreement can access Assembla. (source)

I fought for a while trying to setup a freshly built Clojure and swank-clojure/SLIME for Emacs 23 on Windows, and when I thought I had reached a satisfying and simple enough solution I wrote a short post documenting the steps. But then I am not sure if my solution is general enough, because it seems that it's not working for some people, possibly because of some of the "mysterious reasons" that you mention..

What if you want to build a .emacs.d directory you can simply copy from one system to another and have everything work? (You can do this with most Emacs libs.)

This works fine with package.el-installed packages. If you're having trouble with it, please file a bug with package.el.

Or how do you install and use a bleeding-edge Clojure or clojure-contrib tree with SLIME?

The auto-install of jars via M-x slime was never intended to be used for anything but experimentation. I think this is pretty clear from the documentation, or at least it is now. If you use lein swank or M-x swank-clojure-project, it's really easy to get whatever version you like from the official Clojure build server. (No compilation necessary.)

Most of these jars end up in ~/.m2 nowadays, I think? Used to be ~/.swank-clojure or ~/.clojure or something? And ~/.emacs.d/elpa gets stuff too? Color me continually confused.

Sure, here's the breakdown: ~/.m2 is used by Maven and Leiningen. ~/.swank-clojure is used by swank's auto-install. ~/.clojure is an older location that is also checked for jars that may have been manually placed there. ~/.emacs.d/elpa is where elisp code goes, naturally.

But if you want to get bleeding-edge everything working yourself, all I have to say is God help you, because it's largely unsupported. Be prepared to hack and patch until it works.

Please be specific about the problems you encounter. I know ranting is cathartic, but I'm more interested in making things work smoothly. =)

Quoth angel on June 25, 2011 @ 5:32 AM PDT

In windows is simple...install cojure box...clojure box bring with emacs 23, slime, clojure-mode, clojure and clojure contrib..even I think it has example codes and other stuffs...:D...

I'm using clojure with windows because my emacs config in linux is a mess...

I've used ELPA and it work great too...maybe excluding clojure box..it would be the simplest way