Setting up Clojure with Swank and Slime and Emacs and everything can be a pain, especially if you don't want to use ELPA. At the time of this writing (2010-01) I've shown this to several people, who seem to use it now, and it works for me. So, maybe it will help you...
This deals with the new release of Clojure 1.1 and uses the first RC of Clojure-Contrib 1.1
The community is working on a central entry point for getting started with Clojure which can be found at http://www.assembla.com/wiki/show/clojure/Getting_Started
Please consider that page as your official tutorial for setting up clojure with the various IDEs out there.
Please note that this tutorial describes my setup and I don't use ELPA and I go against the grain. If you're looking for the way to do things intended by the author(s) of swank-clojure and clojure-mode, please go to
http://github.com/technomancy/swank-clojure
If you are a notorious Emacs weenie and want things to work your way with your version of your beloved editor, which you've been customizing for aeons, you may continue to read now ;-)
This description is currently broken!
It won't work because the clojure-1.1 branch of swank-clojure is not available anymore. So, don't even consider trying this! See the Getting Started section above for how to setup Emacs, Clojure and Slime.
The rest remains here for me as a remainder to fix this when I find the time...
shell> mkdir ~/opt/clojure/1.1 shell> cd ~/opt/clojure/1.1 # dont forget to unzip and build! shell> wget http://clojure.googlecode.com/files/clojure-1.1.0.zip # Remove linebreaks from the following! shell> wget http://www.google.com/url?sa=D&q=http://clojure- contrib.googlecode.com/files/clojure-contrib-1.1.0- RC1.zip&usg=AFQjCNFx6dL4H7mVtH1O8eUJUKaahEVb8g shell> git clone git://github.com/technomancy/clojure-mode.git shell> git clone http://github.com/technomancy/swank-clojure.git shell> cvs -d :pserver:anonymous:anonymous@common-lisp.net:/project/slime/cvsroot co slime
I have a script called clj1.1 in my PATH which looks approximately like this
#!/bin/bash
BASE=/home/ska/opt/clojure/1.1/
export CLJ_HOME=$BASE/clojure-1.1.0
export CLJ_CONTRIB_HOME=$BASE/clojure-contrib-1.1.0-RC1/
# need to adapt this when switching to branch for 1.1:
export SWANK_HOME=$BASE/swank-clojure/src/
# I have this on one line
java -server
-cp $CLJ_HOME/clojure.jar:
$CLJ_CONTRIB_HOME/clojure-contrib.jar:
$SWANK_HOME clojure.main "$@"
First make sure that everything works here. You should be able to call this script from the command line and get a REPL.
shell> cd ~/opt/clojure/1.1/swank-clojure shell> git checkout -b clj1.1 clojure-1.1
Whenever I find the time to setup the master-branch of clojure itself I will try to get the master branch of swank-clojure to work, too. However, I don't expect one Emacs-setup to be able to support several versions of clojure and/or the accompanying libs. But we will see.
First add the relevant directories to your load-path, e.g.
(setq load-path
(append
(list
"~/.emacs.d/lisp"
"~/opt/clojure/1.1/clojure-mode/"
"~/opt/clojure/1.1/swank-clojure/src/emacs/"
"~/opt/clojure/1.1/slime/"
"~/opt/clojure/1.1/slime/contrib/"
)
load-path))
Then require Slime and set it up. Note that the arglist-backend may have problems, but I didn't get into this since 2009-12 and Phil Hagelberg did several updates to swank-clojure since then; see SLIME REPL Broken.
(require 'slime)
(setq slime-use-autodoc-mode nil)
(slime-setup '(slime-fancy))
(setq swank-clojure-binary "~/bin/clj1.1")
(require 'clojure-mode)
(require 'swank-clojure-autoload))
(setq auto-mode-alist
(cons '("\\.clj$" . clojure-mode)
auto-mode-alist))
(def-slime-selector-method ?j
"most recently visited clojure-mode buffer."
(slime-recently-visited-buffer 'clojure-mode))
(add-hook 'clojure-mode-hook
(lambda ()
(setq fill-column 80)
(setq indent-tabs-mode nil)
))
(require 'swank-clojure))
I've used to setup Clojure successfully for Linux and (bless me) OSX.