Skip to content

Commit

Permalink
[Fix clojure-emacs#1459] Dispatch connections according to major-mode…
Browse files Browse the repository at this point in the history
…, 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.
  • Loading branch information
Malabarba authored and cap10morgan committed Dec 23, 2015
1 parent 563e192 commit 48754a9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions cider-client.el
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,10 @@ from the file extension."
(if (= 1 (length project-connections))
;; Only one match, just return it.
(car project-connections)
;; OW, find one matching the extension of current file.
(let ((type (or type (file-name-extension (or (buffer-file-name) "")))))
;; OW, find one matching the language of the current buffer.
(let ((type (or type cider-repl-type
(if (derived-mode-p 'clojurescript-mode)
"cljs" "clj"))))
(or (seq-find (lambda (conn)
(equal (cider--connection-type conn) type))
project-connections)
Expand Down

0 comments on commit 48754a9

Please sign in to comment.