[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/detached 4b3609385d 01/38: Start session rewrite
From: |
ELPA Syncer |
Subject: |
[elpa] externals/detached 4b3609385d 01/38: Start session rewrite |
Date: |
Thu, 17 Nov 2022 17:57:53 -0500 (EST) |
branch: externals/detached
commit 4b3609385d8910861f1ff338c7b3f97a02564902
Author: Niklas Eklund <niklas.eklund@posteo.net>
Commit: Niklas Eklund <niklas.eklund@posteo.net>
Start session rewrite
---
detached-compile.el | 4 +++-
detached-shell.el | 3 ++-
detached.el | 29 ++++++++++++++++++++++++++++-
3 files changed, 33 insertions(+), 3 deletions(-)
diff --git a/detached-compile.el b/detached-compile.el
index ab3b86d7ef..4ebc51da2f 100644
--- a/detached-compile.el
+++ b/detached-compile.el
@@ -113,7 +113,9 @@ Optionally EDIT-COMMAND."
(pcase-let ((`(,_command ,mode ,name-function ,highlight-regexp)
args))
(if (eq detached-session-mode 'create)
(detached-start-detached-session
detached--current-session)
- (apply compilation-start `(,(detached--shell-command
detached--current-session t)
+ (apply compilation-start `(,(if (eq detached-session-mode
'attach)
+ (detached--shell-command
detached--current-session t)
+ (detached-session-start-command
detached--current-session 'concat))
,(or
mode 'detached-compilation-mode)
,name-function
,highlight-regexp))))
diff --git a/detached-shell.el b/detached-shell.el
index 3c78e69550..11299a488e 100644
--- a/detached-shell.el
+++ b/detached-shell.el
@@ -110,7 +110,8 @@ cluttering the `comint-history' with dtach commands."
(with-connection-local-variables
(let* ((session
(detached-create-session (substring-no-properties string)))
- (command (detached--shell-command session t)))
+ (command
+ (detached-session-start-command session 'concat)))
(setq detached--buffer-session session)
(comint-simple-send proc command))))
diff --git a/detached.el b/detached.el
index 79d21ab25e..d84ee6ef94 100644
--- a/detached.el
+++ b/detached.el
@@ -734,7 +734,7 @@ Optionally SUPPRESS-OUTPUT."
(defun detached-start-detached-session (session)
"Start SESSION in detached mode."
- (if detached-local-session
+ (if (detached-session-local-p session)
(apply #'start-process-shell-command
`("detached" nil ,(detached--dtach-command session t)))
(apply #'start-file-process-shell-command
@@ -905,6 +905,33 @@ This function uses the `notifications' library."
;;;;; Public session functions
+(defun detached-session-start-command (session &optional concat)
+ "Return command to start SESSION.
+
+Optionally return concatenated string when CONCAT."
+ (detached-connection-local-variables
+ (let* ((socket (detached--session-file session 'socket t))
+ (log (detached--session-file session 'log t)))
+ (if (detached-session-degraded-p session)
+ (let ((tail-command
+ `(,detached-tail-program
+ "--follow=name"
+ "--retry"
+ ,(concat "--lines=" detached-session-context-lines)
+ ,log)))
+ (when (eq 'create-and-attach
+ (detached--session-initial-mode session))
+ (detached-start-detached-session session))
+ (if concat (string-join tail-command " ") tail-command))
+ (let ((dtach-command
+ `(,detached-dtach-program
+ ,(detached--dtach-arg) ,socket "-z"
+ ,detached-shell-program "-c"
+ ,(if concat
+ (shell-quote-argument (detached--detached-command
session))
+ (detached--detached-command session)))))
+ (if concat (string-join dtach-command " ") dtach-command))))))
+
(defun detached-session-output (session)
"Return content of SESSION's output."
(let* ((filename (detached--session-file session 'log))
- [elpa] externals/detached 18c388bb48 36/38: Update attach shell command, (continued)
- [elpa] externals/detached 18c388bb48 36/38: Update attach shell command, ELPA Syncer, 2022/11/17
- [elpa] externals/detached 88f925ee15 14/38: Add missing string-join, ELPA Syncer, 2022/11/17
- [elpa] externals/detached 4cc2c4e40f 12/38: Add select host session completion function, ELPA Syncer, 2022/11/17
- [elpa] externals/detached d1c3861e8e 16/38: Add public function for session directory, ELPA Syncer, 2022/11/17
- [elpa] externals/detached ca0ee7e465 37/38: Add detach key to session map, ELPA Syncer, 2022/11/17
- [elpa] externals/detached 274993d9c9 20/38: Remove 'started state, ELPA Syncer, 2022/11/17
- [elpa] externals/detached 51858bceb7 26/38: Begin rework of how to start a session, ELPA Syncer, 2022/11/17
- [elpa] externals/detached 65c661bc9c 27/38: Change detached env to text-mode, ELPA Syncer, 2022/11/17
- [elpa] externals/detached 3dc3651e98 18/38: Add session working directory function, ELPA Syncer, 2022/11/17
- [elpa] externals/detached 88618a9cee 17/38: Add public function for session command, ELPA Syncer, 2022/11/17
- [elpa] externals/detached 4b3609385d 01/38: Start session rewrite,
ELPA Syncer <=
- [elpa] externals/detached f0f9728e2c 31/38: Make local predicate private, ELPA Syncer, 2022/11/17
- [elpa] externals/detached 09b37f681c 30/38: Add detached-with-session macro, ELPA Syncer, 2022/11/17
- [elpa] externals/detached a57a728382 22/38: Remove detached-session-mode 'attach, ELPA Syncer, 2022/11/17
- [elpa] externals/detached 4e36d9de69 10/38: Make current session public, ELPA Syncer, 2022/11/17
- [elpa] externals/detached f896cd9777 32/38: Reformat code, ELPA Syncer, 2022/11/17
- [elpa] externals/detached 0d607044d9 03/38: Add session started predicate, ELPA Syncer, 2022/11/17
- [elpa] externals/detached 4eb5e3e9aa 04/38: Add side effect to start command, ELPA Syncer, 2022/11/17
- [elpa] externals/detached b3fa3b9893 13/38: Move functions to end to prepare for deprecation, ELPA Syncer, 2022/11/17
- [elpa] externals/detached 1604a7b5b8 11/38: Make detached-buffer-session public, ELPA Syncer, 2022/11/17
- [elpa] externals/detached 26210dc5a8 28/38: Improve the core structure, ELPA Syncer, 2022/11/17