@@ -204,25 +204,28 @@ 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
- (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 language of the current buffer.
218
- (let ((type (or type cider-repl-type
219
- (if (derived-mode-p 'clojurescript-mode )
220
- " cljs" " clj" ))))
221
- (or (seq-find (lambda (conn )
222
- (equal (cider--connection-type conn) type))
223
- project-connections)
224
- (car project-connections)
225
- (car connections)))))))))
207
+ ; ; if you're in a REPL buffer, it's the connection buffer
208
+ (if (derived-mode-p 'cider-repl-mode )
209
+ (current-buffer )
210
+ (let ((connections (cider-connections)))
211
+ (cond
212
+ ((eq cider-request-dispatch 'static ) (car connections))
213
+ ((= 1 (length connections)) (car connections))
214
+ (t (let ((project-connections
215
+ (cider-find-connection-buffer-for-project-directory
216
+ nil :all-connections )))
217
+ (if (= 1 (length project-connections))
218
+ ; ; Only one match, just return it.
219
+ (car project-connections)
220
+ ; ; OW, find one matching the language of the current buffer.
221
+ (let ((type (or type cider-repl-type
222
+ (if (derived-mode-p 'clojurescript-mode )
223
+ " cljs" " clj" ))))
224
+ (or (seq-find (lambda (conn )
225
+ (equal (cider--connection-type conn) type))
226
+ project-connections)
227
+ (car project-connections)
228
+ (car connections))))))))))
226
229
227
230
(defun cider-other-connection (&optional connection )
228
231
" Return the first connection of another type than CONNECTION
0 commit comments