Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

adding mvnrepl

  • Loading branch information...
commit 60943c8e2443231c2535dc34a4a0cdeb5c0a417f 1 parent c362e8a
@alandipert authored
Showing with 35 additions and 0 deletions.
  1. +35 −0 init.el
View
35 init.el
@@ -310,3 +310,38 @@
(put 'downcase-region 'disabled nil)
(put 'upcase-region 'disabled nil)
(put 'set-goal-column 'disabled nil)
+
+;;
+;; mvnrepl
+;;
+
+(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)
Please sign in to comment.
Something went wrong with that request. Please try again.