Created
August 13, 2010 11:06
-
-
Save edgargoncalves/522706 to your computer and use it in GitHub Desktop.
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
(require 'pc-select) | |
(defun slime-update-clojure-namespace () | |
"Find the namespace in the current buffer and use SLIME's REPL | |
to switch to it, updating the namespace for all buffers." | |
(interactive) | |
(save-excursion | |
;; search for this buffer's namespace: | |
(goto-char 0) | |
(when (search-forward "(ns " nil t) | |
(let ((beg (point)) | |
(end (save-excursion | |
(forward-sexp 1) | |
(point)))) | |
(copy-region-as-kill-nomark beg end)) | |
;; send the in-ns command to slime's repl: | |
(set-buffer (slime-output-buffer)) | |
(unless (eq (current-buffer) (window-buffer)) | |
(pop-to-buffer (current-buffer) t)) | |
(goto-char (point-max)) | |
(insert "(in-ns '") | |
(yank) | |
(insert ")") | |
(progn | |
(slime-repl-return) | |
(other-window 1))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment