Skip to content

Commit 4a41360

Browse files
committed
[Fix #2084] Select correct REPL type in cider-switch-to-repl-buffer
1 parent 21bdb8d commit 4a41360

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
### Bugs Fixed
1818

19+
* [#2084](https://github.com/clojure-emacs/cider/issues/2084): Select correct REPL type (clj or cljs) in cider-switch-to-repl-buffer conditional on the current buffer.
1920
* [#2088](https://github.com/clojure-emacs/cider/issues/2088): Fix functions defined with `def` being font-locked as vars instead of functions.
2021
* [#1651](https://github.com/clojure-emacs/cider/issues/1651), [cider-nrepl#445](https://github.com/clojure-emacs/cider-nrepl/pull/455): Fix `cider-expected-ns` returns `nil` on boot projects.
2122

cider-mode.el

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,17 @@ With a prefix arg SET-NAMESPACE sets the namespace in the REPL buffer to that
138138
of the namespace in the Clojure source buffer."
139139
(interactive "P")
140140
(let* ((connections (cider-connections))
141-
(buffer (seq-find (lambda (b) (member b connections))
142-
(buffer-list))))
143-
(cider--switch-to-repl-buffer buffer set-namespace)))
141+
(type (cider-connection-type-for-buffer))
142+
(a-repl nil)
143+
(the-repl (seq-find (lambda (b)
144+
(when (member b connections)
145+
(unless a-repl
146+
(setq a-repl b))
147+
(equal type (cider-connection-type-for-buffer b))))
148+
(buffer-list))))
149+
(if-let ((repl (or the-repl a-repl)))
150+
(cider--switch-to-repl-buffer repl set-namespace)
151+
(user-error "No REPL found"))))
144152

145153
(declare-function cider-load-buffer "cider-interaction")
146154

0 commit comments

Comments
 (0)