Created
January 3, 2011 19:13
-
-
Save alandipert/763791 to your computer and use it in GitHub Desktop.
Run the mvn clojure:repl task in emacs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defgroup mvnrepl nil | |
"run mvn clojure:repl from emacs" | |
:prefix "mvnrepl-" | |
:group 'applications) | |
(defcustom mvnrepl-mvn "mvn" | |
"Maven 'mvn' command." | |
:type 'string | |
:group 'mvnrepl) | |
(defun mvnrepl-project-root () | |
"Look for pom.xml file to find project root." | |
(let ((cwd default-directory) | |
(found nil) | |
(max 10)) | |
(while (and (not found) (> max 0)) | |
(if (file-exists-p (concat cwd "pom.xml")) | |
(setq found cwd) | |
(setq cwd (concat cwd "../") max (- max 1)))) | |
(and found (expand-file-name found)))) | |
(defun mvnrepl () | |
"From a buffer with a file in the project open, run M-x mvn-repl to get a project inferior-lisp" | |
(interactive) | |
(let ((project-root (mvnrepl-project-root))) | |
(if project-root | |
(inferior-lisp (concat mvnrepl-mvn " -f " project-root "/pom.xml clojure:repl")) | |
(message (concat "Maven project not found."))))) | |
(provide 'mvnrepl) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment