Setting up Clojure, Emacs, Slime, and Swank

A quick and dirty guide to setting up Clojure, Emacs, Slime, and Swank.  

Get git:

$ sudo port install git-core      # OSX with MacPorts
$ sudo apt-get install git-core   # Debian/Ubuntu

Get ant:

$ sudo port install apache-ant    # OSX with MacPorts
$ sudo apt-get install ant        # Debian/Ubuntu

Get maven:

$ sudo port install maven2        # OSX with MacPorts
$ sudo apt-get install maven2     # Debian/Ubuntu

Set up a git source directory:

$ mkdir ~/git

Get clojure:

$ cd ~/git
$ git clone git://github.com/richhickey/clojure.git
$ cd clojure
$ ant

Get clojure-contrib:

$ cd ~/git
$ git clone git://github.com/richhickey/clojure-contrib.git
$ cd clojure-contrib
$ mvn package

Get clojure-mode:

$ cd ~/git
$ git clone git://github.com/jochu/clojure-mode.git

Get slime:

$ cd ~/git
$ git clone git://git.boinkor.net/slime.git

Get swank-clojure:

$ cd ~/git
$ git clone git://github.com/jochu/swank-clojure.git

Update your .emacs:

;; Clojure
(add-to-list 'load-path "~/git/clojure-mode")
(add-to-list 'load-path "~/git/swank-clojure/src/emacs")
(add-to-list 'load-path "~/git/slime")

(setq swank-clojure-jar-path "~/git/clojure/clojure-1.2.0-master-SNAPSHOT.jar")

;; clojure-contrib, when compiled as above, is not working at the moment
;; (setq swank-clojure-extra-classpaths
;;      (list "~/git/clojure-contrib/clojure-contrib.jar"))

(require 'clojure-mode)
(require 'swank-clojure-autoload)
(require 'slime)

(eval-after-load "slime" (slime-setup '(slime-repl)))
(slime-setup)

Run emacs:

$ emacs test.clj
M-x slime  
; Wait for slime to invoke and connect to the clojure REPL

Enjoy!




Navigation

  Sign in   Recent Site Activity   Terms   Report Abuse   Print page  |  Powered by Google Sites