I believe that with the sort of setup that you describe, M-x slime will put everything in ~/.clojure
and ~/.swank-clojure
on the classpath. You can customise this by setting the swank-clojure-classpath
variable (I have it customised to use ~/.clojure
only; that's where I put the basic set of jars useful for launching one-off experimental REPLs.
As soon as you need more stuff on the classpath, the above is inadequate. There are two options for managing those more complex cases:
Option 1: launch Swank, then connect
The most straightforward approach is to use Leiningen. Put this in your project.clj
:
(defproject repl-base "1.0.0-SNAPSHOT"
:description "A project to start Swank in."
:dependencies [[org.clojure/clojure "1.2.0"]
[org.clojure/clojure-contrib "1.2.0"]]
:dev-dependencies [[swank-clojure "1.2.1"]])
Then use lein swank
in your project's directory to start a swank server and use M-x slime-connect to connect to it from within Emacs.
As another possibility, David Edgar Liebke's cljr will apparently launch stand-alone Swank instances for you; consult the README for details.
Option 2: launch Swank from within Emacs
Now, to be entirely honest, I tend to start Swank from within Emacs myself -- it's maybe a bit trickier to setup (and thus possibly not advisable in the beginning), but quite convenient later on. See my answer to an older question for one version of a function I use to launch Clojure-specific Swank instances complete with proper classpath configuration for Leiningen-style projects.