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

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

[elpa] externals/detached 441c21f5da 3/7: Remove validator function


From: ELPA Syncer
Subject: [elpa] externals/detached 441c21f5da 3/7: Remove validator function
Date: Mon, 21 Nov 2022 10:57:32 -0500 (EST)

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

    Remove validator function
    
    We validate by listening to events in the session directory. The only
    thing it wouldn't catch is if dtach path is wrong. But that is a rare
    case and maybe we can have a check for dtach executable instead.
---
 detached.el | 26 ++++----------------------
 1 file changed, 4 insertions(+), 22 deletions(-)

diff --git a/detached.el b/detached.el
index b54edbb86c..3ff3ad0e0b 100644
--- a/detached.el
+++ b/detached.el
@@ -740,7 +740,7 @@ active session.  For sessions created with 
`detached-compile' or
                                     :working-directory 
(detached--get-working-directory)
                                     :degraded (detached-degraded-command-p 
command)
                                     :initial-mode detached-session-mode
-                                    :time `(:start ,(time-to-seconds 
(current-time)) :end 0.0 :duration 0.0 :offset 0.0)
+                                    :time `(:start 0.0 :end 0.0 :duration 0.0 
:offset 0.0)
                                     :status '(unknown . 0)
                                     :annotation detached-session-annotation
                                     :local detached-local-session
@@ -953,7 +953,9 @@ This function uses the `notifications' library."
 
 (defun detached-register-session (session)
   "Register the existence of SESSION and start monitoring it."
-  (detached--create-session-validator session)
+  (setf (detached--session-time session) `(:start ,(time-to-seconds 
(current-time)) :end 0.0 :duration 0.0 :offset 0.0))
+  (setf (detached--session-state session) 'started)
+  (detached--db-update-entry session)
   (detached--watch-session-directory (detached-session-directory session)))
 
 ;;;;; Public session functions
@@ -1369,26 +1371,6 @@ This function uses the `notifications' library."
   "Return the session associated with ITEM."
   (cdr (assoc item detached--session-candidates)))
 
-(defun detached--create-session-validator (session)
-  "Create a function to validate SESSION.
-
-It can take some time for a dtach socket to be created.  Therefore all
-sessions are created with state unknown.  This function creates a
-function to verify that a session was created correctly.  If the
-session is missing its deleted from the database."
-  (let ((session-id (detached-session-id session)))
-    (push session-id detached--unvalidated-session-ids)
-    (run-with-timer detached-dtach-socket-creation-delay
-                    nil
-                    (lambda ()
-                      (when (member session-id 
detached--unvalidated-session-ids)
-                        (setq detached--unvalidated-session-ids (delete 
session-id detached--unvalidated-session-ids))
-                        (let ((session (detached--db-get-session session-id)))
-                          (if (detached--session-missing-p session)
-                              (detached--db-remove-entry session)
-                            (setf (detached--session-state session) 'active)
-                            (detached--db-update-entry session))))))))
-
 (defun detached--session-file (session file &optional local)
   "Return the full path to SESSION's FILE.
 



reply via email to

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