@@ -204,26 +204,23 @@ current directory (see `cider-find-connection-buffer-for-project-directory').
204
204
If there is ambiguity, it is resolved by matching TYPE with the REPL
205
205
type (Clojure or ClojureScript). TYPE is a string, which when nil is derived
206
206
from the file extension."
207
- (cider-connections) ; Cleanup the connections list.
208
- (if (eq cider-request-dispatch 'dynamic )
209
- (cond
210
- ((and (not type) (cider--in-connection-buffer-p)) (current-buffer ))
211
- ((= 1 (length cider-connections)) (car cider-connections))
212
- (t (let ((project-connections
213
- (cider-find-connection-buffer-for-project-directory
214
- nil :all-connections )))
215
- (if (= 1 (length project-connections))
216
- ; ; Only one match, just return it.
217
- (car project-connections)
218
- ; ; OW, find one matching the extension of current file.
219
- (let ((type (or type (file-name-extension (or (buffer-file-name ) " " )))))
220
- (or (seq-find (lambda (conn )
221
- (equal (cider--connection-type conn) type))
222
- project-connections)
223
- (car project-connections)
224
- (car cider-connections)))))))
225
- ; ; TODO: Add logic to dispatch to a matching Clojure/ClojureScript REPL based on file type
226
- (car cider-connections)))
207
+ (let ((connections (cider-connections)))
208
+ (cond
209
+ ((eq cider-request-dispatch 'static ) (car connections))
210
+ ((= 1 (length connections)) (car connections))
211
+ (t (let ((project-connections
212
+ (cider-find-connection-buffer-for-project-directory
213
+ nil :all-connections )))
214
+ (if (= 1 (length project-connections))
215
+ ; ; Only one match, just return it.
216
+ (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 ) " " )))))
219
+ (or (seq-find (lambda (conn )
220
+ (equal (cider--connection-type conn) type))
221
+ project-connections)
222
+ (car project-connections)
223
+ (car connections)))))))))
227
224
228
225
(defun cider-other-connection (&optional connection )
229
226
" Return the first connection of another type than CONNECTION
0 commit comments