Skip to content

Commit bad9995

Browse files
committed
Don't disable cider-mode until all CIDER sessions have been closed
1 parent 87f750b commit bad9995

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
* [#2541](https://github.com/clojure-emacs/cider/issues/2541): Hook properly CIDER's code completion machinery.
3737
* [#2659](https://github.com/clojure-emacs/cider/issues/2659): Handle `#shadow/env` reader tags in `cider--shadow-get-builds`.
3838
* [#2676](https://github.com/clojure-emacs/cider/issues/2676): Widen before `cider--file-string`, to allow `cider-load-buffer` to work on narrowed buffers.
39+
* Don't disable `cider-mode` until all CIDER sessions have been closed.
3940

4041
## 0.21.0 (2019-02-19)
4142

cider-connection.el

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@ PARAMS is a plist containing :host, :port, :server and other parameters for
8484
(lambda (_)
8585
(cider-repl-create params)))))
8686

87+
(defun cider-sessions ()
88+
"Return a list of all active CIDER sessions."
89+
(sesman-sessions 'CIDER))
90+
8791
(defun cider-connected-p ()
8892
"Return t if CIDER is currently connected, nil otherwise."
8993
(process-live-p (get-buffer-process (cider-current-repl))))
@@ -248,8 +252,8 @@ See command `cider-mode'."
248252
(cider-mode -1))))
249253

250254
(defun cider-possibly-disable-on-existing-clojure-buffers ()
251-
"If not connected, disable command `cider-mode' on existing Clojure buffers."
252-
(unless (cider-connected-p)
255+
"Disable command `cider-mode' on existing Clojure buffers when all CIDER sessions are closed."
256+
(unless (cider-sessions)
253257
(cider-disable-on-existing-clojure-buffers)))
254258

255259
(declare-function cider--debug-init-connection "cider-debug")
@@ -345,8 +349,8 @@ REPL defaults to the current REPL."
345349
(sesman-browser-get 'object)
346350
(cider-current-repl nil 'ensure))))
347351
(cider--close-connection repl))
348-
;; if there are no more connections we can kill all ancillary buffers
349-
(unless (cider-connected-p)
352+
;; if there are no more sessions we can kill all ancillary buffers
353+
(unless (cider-sessions)
350354
(cider-close-ancillary-buffers))
351355
;; need this to refresh sesman browser
352356
(run-hooks 'sesman-post-command-hook))
@@ -475,8 +479,8 @@ Fallback on `cider' command."
475479

476480
(cl-defmethod sesman-quit-session ((_system (eql CIDER)) session)
477481
(mapc #'cider--close-connection (cdr session))
478-
;; if there are no more connections we can kill all ancillary buffers
479-
(unless (cider-connected-p)
482+
;; if there are no more session we can kill all ancillary buffers
483+
(unless (cider-sessions)
480484
(cider-close-ancillary-buffers)))
481485

482486
(cl-defmethod sesman-restart-session ((_system (eql CIDER)) session)

0 commit comments

Comments
 (0)