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

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

[nongnu] elpa/sesman 0ea1d3e645 048/100: [Fix #7] Implement WHICH argume


From: ELPA Syncer
Subject: [nongnu] elpa/sesman 0ea1d3e645 048/100: [Fix #7] Implement WHICH argument in `sesman-restart`
Date: Tue, 28 Dec 2021 14:06:01 -0500 (EST)

branch: elpa/sesman
commit 0ea1d3e6451632c7b2c2a5adad7a04c47fe4db3a
Author: Vitalie Spinu <spinuvit@gmail.com>
Commit: Vitalie Spinu <spinuvit@gmail.com>

    [Fix #7] Implement WHICH argument in `sesman-restart`
---
 sesman.el | 29 +++++++++++++++++++++--------
 1 file changed, 21 insertions(+), 8 deletions(-)

diff --git a/sesman.el b/sesman.el
index 1215061c84..9b0abe3250 100644
--- a/sesman.el
+++ b/sesman.el
@@ -312,20 +312,33 @@ If SORT is non-nil, sort in relevance order."
     (run-hooks 'sesman-post-command-hook)))
 
 ;;;###autoload
-(defun sesman-restart ()
-  "Restart sesman session."
-  (interactive)
+(defun sesman-restart (&optional which)
+  "Restart sesman session.
+ When WHICH is nil, restart the current session; when a single universal
+argument or 'linked, restart all linked sessions; when a double universal
+argument, t or 'all, restart all sessions. For programmatic use, WHICH can also
+be a session or a name of the session, in which case that session is 
restarted."
+  (interactive "P")
   (let* ((system (sesman--system))
-         (old-session (sesman-ensure-session system)))
-    (message "Restarting %s '%s' session" system (car old-session))
-    (sesman-restart-session system old-session)))
+         (sessions (sesman--on-C-u-u-sessions system which)))
+    (if (null sessions)
+        (message "No %s sessions found" system)
+      (with-temp-message (format "Restarting %s %s %s"  system
+                                 (if (= 1 (length sessions)) "session" 
"sessions")
+                                 (mapcar #'car sessions))
+        (mapc (lambda (s)
+                (sesman-restart-session system s))
+              sessions))
+      ;; restarting is not guaranteed to finish here, but what can we do?
+      (run-hooks 'sesman-post-command-hook))))
 
 ;;;###autoload
 (defun sesman-quit (&optional which)
   "Terminate a Sesman session.
 When WHICH is nil, kill only the current session; when a single universal
-argument or 'linked, kill all linked session; when a double universal argument,
-t or 'all, kill all sessions."
+argument or 'linked, kill all linked sessions; when a double universal 
argument,
+t or 'all, kill all sessions. For programmatic use, WHICH can also be a session
+or a name of the session, in which case that session is killed."
   (interactive "P")
   (let* ((system (sesman--system))
          (sessions (sesman--on-C-u-u-sessions system which)))



reply via email to

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