Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
(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."
;; search for this buffer's namespace:
(goto-char 0)
(when (search-forward "(ns " nil t)
(let ((beg (point))
(end (save-excursion
(forward-sexp 1)
(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 '")
(insert ")")
(other-window 1)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment