Glen Stampoultzis <gst...@gmail.com> writes: > I've recently been trying to work with Emacs and Slime on Windows > using Clojure Box. Having never used emacs at all it is tough > going. I had a question or two regarding best practices. > > The first is regarding classpaths. I've managed to figure out how to > setup my classpath and library path (since I'm using native libs) by > adding the following to my .emacs file:
Clojure is odd because you can't reliably add to the classpath at runtime. Because of this, I unpack all my dependencies in one place (target/dependency) so the classpath never changes. Then I use this function to start Slime: (defun slime-project (path) "Setup classpaths for a clojure project and starts a new SLIME session. Kills existing SLIME session, if any." (interactive (list (ido-read-directory-name "Project root: " (locate-dominating-file default-directory "pom.xml")))) (when (get-buffer "*inferior-lisp*") (kill-buffer "*inferior-lisp*")) (setq swank-clojure-binary nil swank-clojure-jar-path (expand-file-name "target/dependency/" path) swank-clojure-extra-classpaths (mapcar (lambda (d) (expand-file-name d path)) '("src/" "target/classes/" "test/")) swank-clojure-extra-vm-args (list (format "-Dclojure.compile.path=%s" (expand-file-name "target/classes/" path))) slime-lisp-implementations (cons `(clojure ,(swank-clojure-cmd) :init swank-clojure-init) (remove-if #'(lambda (x) (eq (car x) 'clojure)) slime-lisp-implementations))) (save-window-excursion (slime))) I use a single Emacs instance per project. It's possible to have multiple Slime sessions in an instance, but I find this gets confusing and would rather manage them separately. You'll need to remove the call to locate-dominating-file if you're not on Emacs 23 yet. > The other problem I have is with the current working directory. The > swank process seems to use my home directory as the current working > directory regardless of what the current working directory of emacs > currently is. Is there any way to set this and to manage it on a per > project basis? On my machine it uses the current working directory of whatever buffer was open when you launched Slime. Maybe try opening one of your project files before launching? -Phil --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---