Owen on Software

Hello Clojure. Adiós IDE.

12 October 2015 - Comments

Getting a development environment setup for Clojure is not easy. I thought I’d follow-up my previous Clojure post and discuss my attempt to find a solid Clojure editor setup.

Edit: I was wrong

… well, at least partially. When I wrote this originally I hadn’t realised there was a free non-commercial license for Cursive. I still stand by most of what I said below. However, now having tried Cursive there’s no going back to anything else for me.

I’ve tried to put the record straight in a follow-up post to this one Hello Clojure. Hello Cursive. (Albeit a year late! Blogging eh, who has the time for that?!!).

What no Eclipse plugin?

Well, yes, there is. Counterclockwise exists, and it was my first port of call. But it’s nowhere near as fully featured as its Java and Scala counterparts. The documentation isn’t great, and to be honest it just feels a bit heavy-weight for a dynamic language like Clojure.

The Eclipse functionality shines in areas like refactoring, etc, which statically typed languages like Java and Scala enable. Those tools just don’t apply, to the same extent, in the world of Clojure.

Sublime Text

Next I tried Sublime. SublimeREPL works well, and there’s a bunch of solid Clojure packages available so you can get a good setup. And it was pretty good, while I was just exploring the basics of the language.

With Sublime it was a case of so close, yet so far. The two main bugbears I had were:

  1. Limited auto-completion.
  2. Trouble connecting to nREPLs.

This was a real shame as, otherwise, Sublime is an awesome editor.


Probably the wrong way round in many respects but next I tried Lighttable. Lighttable has a great theme; that’s easy on the eyes, like Sublime. It’s full of neat features, is workspace-aware, and has great Clojure auto-complete, etc.

But again I had trouble connecting to nREPLs, especially when it came to Clojurescript & figwheel. Another issue I had was that it seems to pause/lock-up briefly every so often, which gets annoying after a while.

That said, for anyone just wanting to explore Clojure, and learn the syntax, the Instarepl1 is excellent.

Emacs Live

Word on the street was that a lot of Clojure folk use Emacs2. But I was pretty resistant to using Emacs again. The idea of it felt like a huge backward step3. But having exhausted all other possibilities4, I thought I’d take the plunge.

Emacs Live is a great place to start with Emacs and Clojure5. It comes with a great out-of-the-box Clojure development experience, including paredit, nREPL/CIDER, and great auto-complete.

But it does have two downsides:

  1. A super-contrasty-this-is-going-to-ruin-my-eyesight theme6.
  2. Emacs isn’t workspace-aware, e.g. you can’t open a file with this name-pattern from my current project.

Theme Meme

It took me a while to work out how, but the theme is relatively easy to sort once you know where to disable the pre-package color-pack. If you look in your ~/.emacs.d/init.el file and search for color-pack you can just comment out the line where it’s loaded7. Once that is done, you can just download any theme you like from melpa.org and load as you normally would.

I tried a bunch of themes, a lot of which were overly contrasty for my eyes, and eventually settled on Solarized Dark which is pretty easy on the eyes.

Move over Sublime

To achieve an experience closer to Sublime, and other workspace-aware editors, I ended up installing Projectile. This neat Emacs package recognises Leinengen projects, amongst others. So once installed, you have a workspace-aware Emacs, capable of opening files relative to the current project.

The only thing you are then missing from Sublime is the file-system hierarchy view. I guess the nearest thing you’ve got to this is running the tree command; that’s assuming you are on a Linux-based system.

I <3 Emacs

Once you’ve commited a few keyboard shortcuts to memory, Emacs proves to be a pretty good editor. Maybe I will have another look at Counterclockwise again sometime, but at the moment I’m really happy with Emacs.

Never thought I’d hear myself say that again!

  1. If you’re coming from Scala, it’s basically the same as the Scala IDE worksheet. 

  2. The 2014 State of Clojure survey clearly identified Emacs as being the most popular development environment. 

  3. … and it would be for a statically typed language like Java. 

  4. Okay, there’s Cursive, an IntelliJ plugin. But I wasn’t about to pay for an IDE to learn a Lisp. I was after all a Lisp hater. Plus, coming from Java, I’ve been spoilt by the awesome and totally free IDE that is Eclipse. Yeah, I’m cheap! Turns out I was totally wrong on this. Cursive is free for personal software development. It’s also pretty awesome. 

  5. Prelude is also worth a look. 

  6. To be fair, I am slightly red/green colour-blind. So this could just be me. 

  7. This is almost certainly not the recommended/correct way to go about this. But it does work. 

Tags: Clojure

comments powered by Disqus