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

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

[elpa] externals/detached c47a5ee9d6: Update handling of non started ses


From: ELPA Syncer
Subject: [elpa] externals/detached c47a5ee9d6: Update handling of non started sessions
Date: Tue, 22 Nov 2022 06:57:29 -0500 (EST)

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

    Update handling of non started sessions
---
 detached-compile.el |  2 +-
 detached-list.el    | 17 +++++++++++------
 detached.el         | 20 ++++++++++++--------
 3 files changed, 24 insertions(+), 15 deletions(-)

diff --git a/detached-compile.el b/detached-compile.el
index 1121d243d7..abecc8ea6f 100644
--- a/detached-compile.el
+++ b/detached-compile.el
@@ -135,7 +135,7 @@ Optionally EDIT-COMMAND."
                                               detached-current-session
                                               :type 'string))
           (detached-register-session detached-current-session)
-          (apply compilation-start `(,(if (detached-session-started-p 
detached-current-session)
+          (apply compilation-start `(,(if (detached-session-active-p 
detached-current-session)
                                           (detached-session-attach-command 
detached-current-session
                                                                            
:type 'string)
                                         (detached-session-start-command 
detached-current-session
diff --git a/detached-list.el b/detached-list.el
index 7a817e1e62..ac930b833b 100644
--- a/detached-list.el
+++ b/detached-list.el
@@ -76,7 +76,8 @@ detached list implements."
   :type 'sexp)
 
 (defcustom detached-list-state-symbols
-  '((active . "*")
+  '((unknown . "-")
+    (active . "*")
     (failure . "!")
     (success . " ")
     (initially-attached . "o")
@@ -768,11 +769,15 @@ If prefix-argument is provided unmark instead of mark."
   "Return a string representation of SESSION's status."
   (let* ((status (detached-session-status session))
          (status-str
-          (if (detached-session-active-p session)
-              (alist-get 'active detached-list-state-symbols "?")
-            (if (eq status 'failure)
-                (alist-get 'failure detached-list-state-symbols "?")
-              (alist-get 'success detached-list-state-symbols "?"))))
+          (cond ((detached-session-active-p session)
+                 (alist-get 'active detached-list-state-symbols "?"))
+                ((and (detached-session-inactive-p session) (eq status 
'failure))
+                 (alist-get 'failure detached-list-state-symbols "?"))
+                ((and (detached-session-inactive-p session) (eq status 
'success))
+                 (alist-get 'success detached-list-state-symbols "?"))
+                ((not (detached-session-started-p session))
+                 (alist-get 'unknown detached-list-state-symbols "?"))
+                (t "?")))
          (status-face
           (cond ((and (detached-session-uninitialized-p session)
                       (detached-session-active-p session))
diff --git a/detached.el b/detached.el
index c6364b2960..e3d99f2b19 100644
--- a/detached.el
+++ b/detached.el
@@ -1184,10 +1184,6 @@ This function uses the `notifications' library."
     (when (detached-valid-session session)
       session)))
 
-(defun detached-session-started-p (session)
-  "Return t if SESSION has been started."
-  (eq 'active (detached-session-state session)))
-
 (defun detached-session-validated-p (session)
   "Return t if SESSION has been validated."
   (not
@@ -1206,6 +1202,10 @@ This function uses the `notifications' library."
   "Return t if SESSION is running on the local host."
   (eq 'localhost (detached-session-host-type session)))
 
+(defun detached-session-started-p (session)
+  "Return t if SESSION has been started."
+  (not (eq 'unknown (detached-session-state session))))
+
 (defun detached-session-active-p (session)
   "Return t if SESSION is active."
   (eq 'active (detached-session-state session)))
@@ -1945,7 +1945,9 @@ start searching at NUMBER offset."
 
 (defun detached--duration-str (session)
   "Return SESSION's duration time."
-  (detached--duration-str2 (detached-session-duration session)))
+  (if (detached-session-started-p session)
+      (detached--duration-str2 (detached-session-duration session))
+    ""))
 
 (defun detached--duration-str2 (duration)
   "Return propertized DURATION."
@@ -1959,9 +1961,11 @@ start searching at NUMBER offset."
 
 (defun detached--creation-str (session)
   "Return SESSION's creation time."
-  (format-time-string
-   "%b %d %H:%M"
-   (detached-session-start-time session)))
+  (if (detached-session-started-p session)
+      (format-time-string
+       "%b %d %H:%M"
+       (detached-session-start-time session))
+    ""))
 
 (defun detached--size-str (session)
   "Return the size of SESSION's output."



reply via email to

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