A Basic Emacs Setup for Clojure
Tuesday, November 18, 2008
A month ago, I wrote a post titled "Exploring Clojure (Lisp on the JVM) - Part 2 - Setup". In it, I listed the steps I went though to get Clojure setup on my machine. The steps I listed would normally work ok if you already use Emacs and SLIME and are used to customizing your .emacs file (Note: with the latest Clojure AOT changes, the setup instructions I listed in that post will need a little tweaking). However, my post wasn't meant to be a tutorial or a step-by-step set of instructions, it was just a list of things that I did to get going with Clojure. If you want/need a step-by-step tutorial for getting all the "key" components of a Clojure development environment setup, there is an excellent tutorial available. If, on the other hand, you want to avoid too many setup steps and want to get started with Clojure as quickly as possible, it is quite easy to get a working Emacs development environment setup for Clojure without using SLIME:
- Download latest Clojure from svn:
svn co https://clojure.svn.sourceforge.net/svnroot/clojure clojure
- Download latest clojure-mode from git:
git clone git://github.com/jochu/clojure-mode.git
- Use ant to build clojure (just "cd" to the clojure directory and type "ant")
- Put the following minimal setup in your .emacs file (adjusting the
paths as necessary):
(setq inferior-lisp-program "java -server -cp /path/to/clojure/trunk/clojure.jar clojure.lang.Repl") (setq load-path (cons "/path/to/clojure-mode" load-path)) (require 'clojure-auto)
- Restart Emacs, load a clojure (clj) file in a buffer, press C-c C-z to get a repl and you've got a working development environment setup.

