Phil Hagelberg <p...@hagelb.org> writes: > The solution I've settled on is the clojure-project function:
Here's what I've added to the swank-clojure codebase. It supports the somewhat standard src/ and classes/ project layout style as well as one based on Maven conventions. (defun swank-clojure-project (path) "Setup classpath for a clojure project and starts a new SLIME session. Kills existing SLIME session, if any." (interactive (list (ido-read-directory-name "Project root: " (if (functionp 'locate-dominating-file) ; Emacs 23 only (locate-dominating-file default-directory "src") default-directory)))) ;; TODO: allow multiple SLIME sessions per Emacs instance (when (get-buffer "*inferior-lisp*") (kill-buffer "*inferior-lisp*")) (setq swank-clojure-binary nil swank-clojure-classpath (let ((l (expand-file-name "lib" path))) (if (file-exists-p l) (directory-files l t ".jar$")))) (add-to-list 'swank-clojure-classpath (expand-file-name "src/" path)) ;; For Maven style project layouts (when (or (file-exists-p (expand-file-name "pom.xml" path)) (file-exists-p (expand-file-name "project.clj" path))) (dolist (d '("src/main/clojure/" "src/test/" "target/classes/" "target/dependency/")) (add-to-list 'swank-clojure-classpath (expand-file-name d path))) (add-to-list 'swank-clojure-extra-vm-args (format "-Dclojure.compile.path=%s" (expand-file-name "target/classes/" path)))) (run-hooks 'swank-clojure-project-hook) (setq 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))) > Another option is to use directory-local variables using a > .dir-locals.el file in your project root, but that can only set values > for variables, it can't do things like add a value to an existing list, > so its utility is limited. This version has a hook, so you can customize your one-off project settings using that. Thoughts? -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 Note that posts from new members are moderated - please be patient with your first post. 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 -~----------~----~----~----~------~----~------~--~---