Skip to content
Browse files

Add clojure-update-ns function

  • Loading branch information...
1 parent 9718ee8 commit d05b603c32bdefd5014d22693770ee0bf49b33e9 @kototama committed Apr 25, 2012
Showing with 13 additions and 0 deletions.
  1. +13 −0 clojure-mode.el
View
13 clojure-mode.el
@@ -973,6 +973,19 @@ returned."
(goto-char (point-min))
(insert (format "(ns %s)" (clojure-expected-ns))))
+(defun clojure-update-ns
+ ()
+ "Updates the namespace of the current buffer. Useful if a file has been renamed."
+ (interactive)
+ (let ((nsname (clojure-expected-ns)))
+ (when nsname
+ (save-restriction
+ (save-excursion
+ (save-match-data
+ (if (clojure-find-ns)
+ (replace-match nsname nil nil nil 4)
+ (error "Namespace not found"))))))))
+
;;; Slime help

0 comments on commit d05b603

Please sign in to comment.
Something went wrong with that request. Please try again.