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

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

[elpa] externals/detached 4cc2c4e40f 12/38: Add select host session comp


From: ELPA Syncer
Subject: [elpa] externals/detached 4cc2c4e40f 12/38: Add select host session completion function
Date: Thu, 17 Nov 2022 17:57:54 -0500 (EST)

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

    Add select host session completion function
---
 detached-eshell.el | 12 +-----------
 detached-shell.el  | 12 +-----------
 detached.el        | 10 ++++++++++
 3 files changed, 12 insertions(+), 22 deletions(-)

diff --git a/detached-eshell.el b/detached-eshell.el
index 29248dcc5e..0712b0f3bf 100644
--- a/detached-eshell.el
+++ b/detached-eshell.el
@@ -74,7 +74,7 @@ If prefix-argument directly DETACH from the session."
 (defun detached-eshell-attach-session (session)
   "Attach to SESSION."
   (interactive
-   (list (detached-eshell--select-session)))
+   (list (detached-select-host-session)))
   (when (detached-valid-session session)
     (if (detached-session-active-p session)
         (cl-letf* ((detached-session-mode 'attach)
@@ -104,16 +104,6 @@ If prefix-argument directly DETACH from the session."
     (and (string= (process-name process) "dtach")
          process)))
 
-(defun detached-eshell--select-session ()
-  "Return selected session."
-  (let* ((host-name (car (detached--host)))
-         (sessions
-          (thread-last (detached-get-sessions)
-                       (seq-filter (lambda (it)
-                                     (string= (detached-session-host-name it) 
host-name)))
-                       (seq-filter #'detached-session-active-p))))
-    (detached-completing-read sessions)))
-
 (cl-defmethod detached--detach-session ((_mode (derived-mode eshell-mode)))
   "Detach from session when MODE is `eshell-mode'."
   (when-let ((active-session (detached-session-active-p 
detached-buffer-session))
diff --git a/detached-shell.el b/detached-shell.el
index 8e0f44773e..c6ba5de14f 100644
--- a/detached-shell.el
+++ b/detached-shell.el
@@ -73,7 +73,7 @@ This function also makes sure that the HISTFILE is disabled 
for local shells."
 `comint-add-to-input-history' is temporarily disabled to avoid
 cluttering the `comint-history' with dtach commands."
   (interactive
-   (list (detached-shell--select-session)))
+   (list (detached-select-host-session)))
   (when (detached-valid-session session)
     (if (detached-session-active-p session)
         (cl-letf ((detached-current-session session)
@@ -88,16 +88,6 @@ cluttering the `comint-history' with dtach commands."
 
 ;;;; Support functions
 
-(defun detached-shell--select-session ()
-  "Return selected session."
-  (let* ((host-name (car (detached--host)))
-         (sessions
-          (thread-last (detached-get-sessions)
-                       (seq-filter (lambda (it)
-                                     (string= (detached-session-host-name it) 
host-name)))
-                       (seq-filter #'detached-session-active-p))))
-    (detached-completing-read sessions)))
-
 (defun detached-shell--attach-input-sender (proc _string)
   "Attach to `detached--session' and send the attach command to PROC."
   (let* ((detached-session-mode 'attach)
diff --git a/detached.el b/detached.el
index cec91828ea..d659c5d1f9 100644
--- a/detached.el
+++ b/detached.el
@@ -1278,6 +1278,16 @@ Optionally CONCAT the command return command into a 
string."
       (push `(,(car annotator) . ,(funcall (cdr annotator))) metadata))
     metadata))
 
+(defun detached-select-host-session ()
+  "Return selected session."
+  (let* ((host-name (car (detached--host)))
+         (sessions
+          (thread-last (detached-get-sessions)
+                       (seq-filter (lambda (it)
+                                     (string= (detached-session-host-name it) 
host-name)))
+                       (seq-filter #'detached-session-active-p))))
+    (detached-completing-read sessions)))
+
 (defun detached-completing-read (sessions)
   "Select a session from SESSIONS through `completing-read'."
   (let* ((candidates (detached-session-candidates sessions))



reply via email to

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