Skip to content

Instantly share code, notes, and snippets.

@edgargoncalves
Created August 13, 2010 11:06
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edgargoncalves/522706 to your computer and use it in GitHub Desktop.
Save edgargoncalves/522706 to your computer and use it in GitHub Desktop.
(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