Created
August 14, 2010 01:07
-
-
Save edgargoncalves/523802 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
(defun slime-update-clojure-namespace (arg) | |
"Find the namespace in the current buffer and use SLIME's REPL | |
to switch to it, updating the namespace for all buffers. | |
Using an universal prefix will ask for the name of the namespace. | |
The actual namespace switch is done by calling `SLIME-REPL-SET-PACKAGE'." | |
(interactive "P") | |
(if arg | |
(call-interactively 'slime-repl-set-package) | |
(save-excursion | |
;; search for this buffer's namespace: | |
(goto-char 0) | |
(if (search-forward "(ns " nil t) | |
(let* ((beg (point)) | |
(end (save-excursion | |
(forward-sexp 1) | |
(point))) | |
(ns (filter-buffer-substring beg end))) | |
(set-text-properties 0 (length ns) nil ns) | |
(slime-repl-set-package ns)) | |
;; no package found | |
(call-interactively 'slime-repl-set-package))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment