Skip to content

Commit 1c087ee

Browse files
Malabarbacap10morgan
authored andcommitted
[Fix #1459] Dispatch connections according to major-mode, not file types
This should make it work automatically for scratch buffers and possibly macroexpand buffers. Additionally takes the value of `cider-repl-type` into consideration. This gives us a way of specifying that non-code temp buffers (like a doc buffer) should use the cljs connection.
1 parent 01a5fd0 commit 1c087ee

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

cider-client.el

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,10 @@ from the file extension."
214214
(if (= 1 (length project-connections))
215215
;; Only one match, just return it.
216216
(car project-connections)
217-
;; OW, find one matching the extension of current file.
218-
(let ((type (or type (file-name-extension (or (buffer-file-name) "")))))
217+
;; OW, find one matching the language of the current buffer.
218+
(let ((type (or type cider-repl-type
219+
(if (derived-mode-p 'clojurescript-mode)
220+
"cljs" "clj"))))
219221
(or (seq-find (lambda (conn)
220222
(equal (cider--connection-type conn) type))
221223
project-connections)

0 commit comments

Comments
 (0)