emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/cider 5d91ffcc75 5/5: Prompt to kill dead repls after choo


From: ELPA Syncer
Subject: [nongnu] elpa/cider 5d91ffcc75 5/5: Prompt to kill dead repls after choosing not to reuse them
Date: Sat, 17 Jun 2023 04:01:33 -0400 (EDT)

branch: elpa/cider
commit 5d91ffcc75069efe9c513af285627a4e38685bb1
Author: yuhan0 <qythium@gmail.com>
Commit: Bozhidar Batsov <bozhidar@batsov.dev>

    Prompt to kill dead repls after choosing not to reuse them
---
 cider-connection.el | 28 ++++++++++++++++++----------
 1 file changed, 18 insertions(+), 10 deletions(-)

diff --git a/cider-connection.el b/cider-connection.el
index b47a11e575..35fc792716 100644
--- a/cider-connection.el
+++ b/cider-connection.el
@@ -861,16 +861,24 @@ PARAMS is a plist as received by `cider-repl-create'."
                                    (if (equal port (plist-get bparams :port)) 
2 0))))))
                     repls))
            (sorted-repls (mapcar #'car (seq-sort-by #'cdr #'> (delq nil 
scored-repls)))))
-      (when sorted-repls
-        (cond ((eq 'any cider-reuse-dead-repls)
-               (car sorted-repls))
-              ((= 1 (length sorted-repls))
-               (when (or (eq 'auto cider-reuse-dead-repls)
-                         (y-or-n-p (format "A dead REPL %s exists.  Reuse 
buffer? " (car sorted-repls))))
-                 (car sorted-repls)))
-              ((y-or-n-p "Dead REPL buffers exist.  Select one to reuse? ")
-               (get-buffer (completing-read "REPL buffer to reuse: " (mapcar 
#'buffer-name sorted-repls)
-                                            nil t nil nil (car 
sorted-repls)))))))))
+      (cond ((null sorted-repls) nil)
+            ((and (= 1 (length sorted-repls))
+                  (eq cider-reuse-dead-repls 'prompt))
+             (if (y-or-n-p (format "A dead REPL %s exists.  Reuse buffer? " 
(car sorted-repls)))
+                 (car sorted-repls)
+               (and (y-or-n-p "Kill dead REPL buffer?")
+                    (kill-buffer (car sorted-repls))
+                    nil)))
+            ((and (< 1 (length sorted-repls))
+                  (memq cider-reuse-dead-repls '(prompt auto)))
+             (if (y-or-n-p "Dead REPL buffers exist.  Select one to reuse? ")
+                 (get-buffer (completing-read "REPL buffer to reuse: " (mapcar 
#'buffer-name sorted-repls)
+                                              nil t nil nil (car 
sorted-repls)))
+               (and (y-or-n-p "Kill all dead REPL buffers?")
+                    (mapc #'kill-buffer sorted-repls)
+                    nil)))
+            (cider-reuse-dead-repls ;; fallthrough for 'auto / 'any / other 
non-nil values
+             (car sorted-repls))))))
 
 (declare-function cider-default-err-handler "cider-eval")
 (declare-function cider-repl-mode "cider-repl")



reply via email to

[Prev in Thread] Current Thread [Next in Thread]