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

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

[elpa] externals/detached 18c388bb48 36/38: Update attach shell command


From: ELPA Syncer
Subject: [elpa] externals/detached 18c388bb48 36/38: Update attach shell command
Date: Thu, 17 Nov 2022 17:57:56 -0500 (EST)

branch: externals/detached
commit 18c388bb4817a0d2c5b7b071873a3aee87bae4a8
Author: Niklas Eklund <niklas.eklund@posteo.net>
Commit: Niklas Eklund <niklas.eklund@posteo.net>

    Update attach shell command
    
    Use detached-with-session macro.
---
 detached.el | 29 ++++++++++++++---------------
 1 file changed, 14 insertions(+), 15 deletions(-)

diff --git a/detached.el b/detached.el
index d13fb5a8aa..7a296506f5 100644
--- a/detached.el
+++ b/detached.el
@@ -574,8 +574,8 @@ Optionally TOGGLE-SESSION-MODE."
 (defun detached-attach-session (session)
   "Attach to SESSION."
   (interactive
-   (list (detached-completing-read (detached-get-sessions))))
-  (when (detached-valid-session session)
+   (list (detached-session-in-context)))
+  (when session
     (let ((initialized-session (detached--get-initialized-session session)))
       (if (detached-session-inactive-p initialized-session)
           (detached-open-session initialized-session)
@@ -909,19 +909,18 @@ This function uses the `notifications' library."
 
 (defun detached-shell-command-attach-session (session)
   "Attach to SESSION with `async-shell-command'."
-  (let* ((detached-current-session session)
-         (inhibit-message t))
-    (cl-letf* (((symbol-function #'set-process-sentinel) #'ignore)
-               (buffer (get-buffer-create detached--shell-command-buffer))
-               (detached-local-session (detached--session-local session))
-               (default-directory (detached-session-directory session))
-               (command (detached-session-attach-command session :type 
'string)))
-      (when (get-buffer-process buffer)
-        (setq buffer (generate-new-buffer (buffer-name buffer))))
-      (funcall #'async-shell-command command buffer)
-      (with-current-buffer buffer
-        (setq-local default-directory (detached-session-working-directory 
session))
-        (setq detached-buffer-session detached-current-session)))))
+  (let* ((inhibit-message t))
+    (detached-with-session session
+      (cl-letf* (((symbol-function #'set-process-sentinel) #'ignore)
+                 (buffer (get-buffer-create detached--shell-command-buffer))
+                 (default-directory (detached-session-directory session))
+                 (command (detached-session-attach-command session :type 
'string)))
+        (when (get-buffer-process buffer)
+          (setq buffer (generate-new-buffer (buffer-name buffer))))
+        (funcall #'async-shell-command command buffer)
+        (with-current-buffer buffer
+          (setq-local default-directory (detached-session-working-directory 
session))
+          (setq detached-buffer-session detached-current-session))))))
 
 (defun detached-start-shell-command-session (session)
   "Start SESSION as a `shell-command'."



reply via email to

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