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

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

[elpa] externals/detached 8c7a2e1129: Update when a session is registere


From: ELPA Syncer
Subject: [elpa] externals/detached 8c7a2e1129: Update when a session is registered
Date: Fri, 18 Nov 2022 07:57:35 -0500 (EST)

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

    Update when a session is registered
    
    This patch updates the time the session is being registered. Instead
    of being when detached-create-session is being called it is registered
    in the different start functions. This will make the code more
    flexible so that sessions can be created at one point in time and
    started later.
---
 detached-compile.el |  8 ++++++--
 detached.el         | 14 ++++++++++----
 2 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/detached-compile.el b/detached-compile.el
index 78a94b2066..1121d243d7 100644
--- a/detached-compile.el
+++ b/detached-compile.el
@@ -130,8 +130,12 @@ Optionally EDIT-COMMAND."
                                           (detached-session-directory 
detached-current-session)
                                         (detached-session-working-directory 
detached-current-session))))
                (if (eq detached-session-mode 'detached)
-            (detached-start-session detached-current-session)
-                 (apply compilation-start `(,(if (detached-session-started-p 
detached-current-session)
+            (detached--start-session-process detached-current-session
+                                             (detached-session-start-command
+                                              detached-current-session
+                                              :type 'string))
+          (detached-register-session detached-current-session)
+          (apply compilation-start `(,(if (detached-session-started-p 
detached-current-session)
                                           (detached-session-attach-command 
detached-current-session
                                                                            
:type 'string)
                                         (detached-session-start-command 
detached-current-session
diff --git a/detached.el b/detached.el
index 479f1fdc17..e4ef56ae17 100644
--- a/detached.el
+++ b/detached.el
@@ -752,12 +752,11 @@ active session.  For sessions created with 
`detached-compile' or
                                     :metadata (detached-metadata)
                                     :state 'unknown
                                     :initialized-emacsen `(,(emacs-pid)))))
-     (detached--create-session-validator session)
-     (detached--watch-session-directory (detached-session-directory session))
      session)))
 
 (defun detached--start-session-process (session start-command)
   "Start SESSION with START-COMMAND."
+  (detached-register-session session)
   (if (detached--session-local-p session)
       (apply #'start-process-shell-command `("detached" nil ,start-command))
     (apply #'start-file-process-shell-command `("detached" nil 
,start-command))))
@@ -936,12 +935,11 @@ This function uses the `notifications' library."
                                                   (not (get-buffer-process 
buffer)))))
              (command (detached-session-start-command session
                                                       :type 'string)))
+    (detached-register-session session)
     (funcall #'async-shell-command command buffer)
     (with-current-buffer buffer
       (setq detached-buffer-session session))))
 
-;;;;; Public session functions
-
 (defun detached-start-session (session)
   "Start SESSION."
   (if (eq 'detached (detached--session-initial-mode session))
@@ -952,8 +950,16 @@ This function uses the `notifications' library."
     (detached-with-session session
       (funcall (detached-session-run-function session) session))))
 
+(defun detached-register-session (session)
+  "Register the existence of SESSION and start monitoring it."
+  (detached--create-session-validator session)
+  (detached--watch-session-directory (detached-session-directory session)))
+
+;;;;; Public session functions
+
 (cl-defun detached-session-start-command (session &key type)
   "Return command to start SESSION with specified TYPE."
+  (detached-register-session session)
   (detached-connection-local-variables
    (let* ((socket (detached--session-file session 'socket t))
           (detached-session-mode (detached--session-initial-mode session))



reply via email to

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