Using something like this run-slime wrapper to start slime may be
useful to others. It helps me avoid some issues when moving from
project to project without restarting emacs. Assuming jar files reside
in each separate project's own "lib" directory, Clojure source in its
"src" directory, and compiled classes in its "classes" directory, run-
slime does the following:

- changes the classpath used by swank-clojure for each project. This
was tricky because simply setting swank-clojure-extra-classpaths and
restarting slime won't do it. The contents of the slime-lisp-
implementations list must be changed.

- makes sure AOT compiling works by creating the "classes" directory
and setting the classpath to include both the src and classes
directories. Even if you specify the "classes" dir in the classpath,
it won't work unless the directory exists in advance of starting
slime.

- also sets the classpath to include all files in the lib
subdirectory. (Note that the lib/* classpath syntax won't work on Java
5.)

(defun reset-swank ()
  "Because changing swank-clojure-extra-classpaths is not enough
to force a new instance of slime to use it."
  (interactive)
  (assq-delete-all 'clojure slime-lisp-implementations)
  (add-to-list 'slime-lisp-implementations
               `(clojure ,(swank-clojure-cmd) :init swank-clojure-
init) t))

(defun run-slime (dir)
  (interactive "DProject directory: ")
  (cd dir)
  (when (not (file-directory-p "classes"))
    (make-directory "classes"))
  (setq swank-clojure-extra-classpaths '("src" "classes" "lib/*"))
  (reset-swank)
  (slime))


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to