[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/detached 51858bceb7 26/38: Begin rework of how to start
From: |
ELPA Syncer |
Subject: |
[elpa] externals/detached 51858bceb7 26/38: Begin rework of how to start a session |
Date: |
Thu, 17 Nov 2022 17:57:55 -0500 (EST) |
branch: externals/detached
commit 51858bceb7e7bff1a1739239f5bfeb656f2c0e04
Author: Niklas Eklund <niklas.eklund@posteo.net>
Commit: Niklas Eklund <niklas.eklund@posteo.net>
Begin rework of how to start a session
---
detached-compile.el | 2 +-
detached.el | 59 +++++++++++++++++++++++------------------------------
2 files changed, 27 insertions(+), 34 deletions(-)
diff --git a/detached-compile.el b/detached-compile.el
index e231c15843..bac300e545 100644
--- a/detached-compile.el
+++ b/detached-compile.el
@@ -111,7 +111,7 @@ Optionally EDIT-COMMAND."
(if detached-enabled
(pcase-let ((`(,_command ,mode ,name-function ,highlight-regexp)
args))
(if (eq detached-session-mode 'detached)
- (detached-start-detached-session
detached-current-session)
+ (detached-start-session2 detached-current-session)
(apply compilation-start `(,(if (detached-session-started-p
detached-current-session)
(detached-session-attach-command
detached-current-session
:type 'string)
diff --git a/detached.el b/detached.el
index 975b40fbc7..a0f3095913 100644
--- a/detached.el
+++ b/detached.el
@@ -706,39 +706,12 @@ active session. For sessions created with
`detached-compile' or
"Start a `detached' session running COMMAND.
Optionally SUPPRESS-OUTPUT."
- (let ((inhibit-message t)
- (detached-enabled t))
- (if-let ((run-in-background
- (or suppress-output
- (eq detached-session-mode 'detached)))
- (detached-session-mode 'detached))
- (let ((detached-current-session
- (or detached-current-session
- (detached-create-session command))))
- (setq detached-enabled nil)
- (detached-start-detached-session
- detached-current-session))
- (cl-letf* ((detached-session-mode 'attached)
- (detached-current-session
- (or detached-current-session
- (detached-create-session command)))
- ((symbol-function #'set-process-sentinel) #'ignore)
- (buffer (detached--generate-buffer
detached--shell-command-buffer
- (lambda (buffer)
- (not (get-buffer-process
buffer)))))
- (command (detached-session-start-command
detached-current-session
- :type 'string)))
- (setq detached-enabled nil)
- (funcall #'async-shell-command command buffer)
- (with-current-buffer buffer
- (setq detached-buffer-session detached-current-session))))))
-
-(defun detached-start-detached-session (session)
- "Start SESSION in detached mode."
- (detached--start-session-process session
- (detached-session-start-command
- session
- :type 'string)))
+ (let* ((detached-session-mode
+ (if suppress-output
+ 'detached
+ detached-session-mode))
+ (session (detached-create-session command)))
+ (detached-start-session2 session)))
(defun detached--start-session-process (session start-command)
"Start SESSION with START-COMMAND."
@@ -910,6 +883,26 @@ This function uses the `notifications' library."
;;;;; Public session functions
+(defun detached-start-session2 (session)
+ "Start SESSION."
+ (if (eq 'detached (detached--session-initial-mode session))
+ (detached--start-session-process session
+ (detached-session-start-command
+ session
+ :type 'string))
+ ;; TODO: Change this part it should use the run function of the session
+ ;; So that this function can be used regardless of origin being shell
command or compile
+ (cl-letf* ((inhibit-message t)
+ ((symbol-function #'set-process-sentinel) #'ignore)
+ (buffer (detached--generate-buffer
detached--shell-command-buffer
+ (lambda (buffer)
+ (not (get-buffer-process
buffer)))))
+ (command (detached-session-start-command
detached-current-session
+ :type 'string)))
+ (funcall #'async-shell-command command buffer)
+ (with-current-buffer buffer
+ (setq detached-buffer-session detached-current-session)))))
+
(cl-defun detached-session-start-command (session &key type)
"Return command to start SESSION with specified TYPE."
(detached-connection-local-variables
- [elpa] externals/detached 473fcc2d43 23/38: Rename detached-session-modes, (continued)
- [elpa] externals/detached 473fcc2d43 23/38: Rename detached-session-modes, ELPA Syncer, 2022/11/17
- [elpa] externals/detached 5c212b2609 05/38: Update start-detached-session, ELPA Syncer, 2022/11/17
- [elpa] externals/detached aca448c773 19/38: Revert marks in list when widening, ELPA Syncer, 2022/11/17
- [elpa] externals/detached f70ac98dc5 21/38: Remove dtach--arg dependency, ELPA Syncer, 2022/11/17
- [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 <=
- [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, 2022/11/17
- [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