Setting-up clojure, clojure-mode and slime with Common-Lisp on Emacs
I've been working a lot with lisp lately. I was basicaly using scheme to follow the SICP course described here.
Yesterday I started to read Programming Clojure from Stuart Halloway
So, as an emacs user the first thing I did was look for a clojure-mode. Found one at http://clojure.codestuffs.com/. In fact found more than just a mode, found a slime/swank for clojure. I decided to install it.
Then I only had to list the packages with
M-x package-list-packages
and then:
M-x package-install
This last command will ask you the name of the package. Type clojure-mode.
After that, the clojure-mode will be installed. The next step is to install the slime/swank for clojure. Once the clojure-mode is installed, it is pretty easy to do:
M-x clojure-install
The installer will ask you where you want to install clojure. I choose /opt/clojure.
Now let's hack our personal emacs configuraiton to enable sbcl (Common Lisp) in our slime.First, If you didn't choose the default location for clojure (like my case), you will have to add the following line in your .emacs file:
And that's it. When you need to use sbcl (Common-Lisp) you must run:
M-x slime
when you need to run clojure do:
M-- M-x slime
This will make slime ask you what lisp you want to start (tab for auto-completion). If you type clojure it will open the Clojure's REPL, if you type sbcl it will open Common-Lisp REPL.To finish I don't like to type java -cp clojure.jar clojure.main to start clojure or even to run some script. So I used the clojure-extra found at http://clojure.codestuffs.com/
Added this file to my $PATH variable and created the file .clojure.conf in my home directory, like that:
You can customize and add things as you wish to your classpath by editing this file.
Done, now you just type clojure and the Clojure's REPL will show up. Have a happy hack.

