Skip to content

Commit aeb125e

Browse files
committed
Simplify cider-repl-set-ns
There's no need to actually do an eval to change the namespace of the REPL - we only have to change it's nrepl-buffer-ns, as it's attached to all eval requests made from the REPL buffer.
1 parent 4dd1526 commit aeb125e

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

cider-repl.el

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -659,17 +659,6 @@ text property `cider-old-input'."
659659
(cider-eval-and-get-value
660660
"(clojure.core/map clojure.core/str (clojure.core/all-ns))"))
661661

662-
(defun cider-repl-switch-ns-handler (buffer)
663-
"Make a nREPL evaluation handler for the REPL ns switching."
664-
(nrepl-make-response-handler buffer
665-
(lambda (buffer value))
666-
(lambda (buffer out)
667-
(cider-repl-emit-output buffer out))
668-
(lambda (buffer err)
669-
(cider-repl-emit-err-output buffer err))
670-
(lambda (buffer)
671-
(cider-repl-emit-prompt buffer))))
672-
673662
(defun cider-repl-set-ns (ns)
674663
"Switch the namespace of the REPL buffer to NS.
675664
@@ -681,9 +670,8 @@ namespace to switch to."
681670
(cider-current-ns))))
682671
(if ns
683672
(with-current-buffer (cider-current-repl-buffer)
684-
(cider-eval
685-
(format "(in-ns '%s)" ns)
686-
(cider-repl-switch-ns-handler (current-buffer))))
673+
(setq nrepl-buffer-ns ns)
674+
(cider-repl-emit-prompt (current-buffer)))
687675
(error "Cannot determine the current namespace")))
688676

689677

0 commit comments

Comments
 (0)