Skip to content

Commit 064cfbf

Browse files
expezMalabarba
authored andcommitted
Refactor cider-current-connection
* repls -> project-connections * Fix considering all connections in the branch for project connections. AFAICT this only worked correctly because of the order in the list being checked.
1 parent ac0f0d7 commit 064cfbf

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

cider-client.el

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -207,21 +207,22 @@ from the file extension."
207207
(cider-connections) ; Cleanup the connections list.
208208
(if (eq cider-request-dispatch 'dynamic)
209209
(cond
210-
((cider--in-connection-buffer-p) (current-buffer))
210+
((and (not type) (cider--in-connection-buffer-p)) (current-buffer))
211211
((= 1 (length cider-connections)) (car cider-connections))
212-
(t (let ((repls (cider-find-connection-buffer-for-project-directory
213-
nil :all-connections)))
214-
(if (= 1 (length repls))
212+
(t (let ((project-connections
213+
(cider-find-connection-buffer-for-project-directory
214+
nil :all-connections)))
215+
(if (= 1 (length project-connections))
215216
;; Only one match, just return it.
216-
(car repls)
217+
(car project-connections)
217218
;; OW, find one matching the extension of current file.
218219
(let ((type (or type (file-name-extension (or (buffer-file-name) "")))))
219220
(or (seq-find (lambda (conn)
220221
(equal (with-current-buffer conn
221222
cider-repl-type)
222223
type))
223-
(append repls cider-connections))
224-
(car repls)
224+
project-connections)
225+
(car project-connections)
225226
(car cider-connections)))))))
226227
;; TODO: Add logic to dispatch to a matching Clojure/ClojureScript REPL based on file type
227228
(car cider-connections)))

0 commit comments

Comments
 (0)