Skip to content

Commit 788ba58

Browse files
committed
Check whether there are multiple active connections in cider-rotate-default-connection
1 parent 49ef3c5 commit 788ba58

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
* [cider-nrepl#438](https://github.com/clojure-emacs/cider-nrepl/pull/438): Improve startup time by deferring loading CIDER's middleware until the first usage.
1313
* [#2078](https://github.com/clojure-emacs/cider/pull/2078): Improve startup time by bundling together sync requests during startup.
14+
* `cider-rotate-default-connection` will warn if you use it with only a single active connection.
1415

1516
### Bugs Fixed
1617

cider-client.el

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1150,11 +1150,13 @@ default connection."
11501150
"Rotate and display the default nREPL connection."
11511151
(interactive)
11521152
(cider-ensure-connected)
1153-
(setq cider-connections
1154-
(append (cdr cider-connections)
1155-
(list (car cider-connections))))
1156-
(message "Default nREPL connection: %s"
1157-
(cider--connection-info (car cider-connections))))
1153+
(if (= (length (cider-connections)) 1)
1154+
(user-error "There's just a single active nREPL connection")
1155+
(setq cider-connections
1156+
(append (cdr cider-connections)
1157+
(list (car cider-connections))))
1158+
(message "Default nREPL connection: %s"
1159+
(cider--connection-info (car cider-connections)))))
11581160

11591161
(defun cider-replicate-connection (&optional conn)
11601162
"Establish a new connection based on an existing connection.

0 commit comments

Comments
 (0)