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

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

[elpa] externals/detached 4fb196ab31 2/3: Add public predicates for un/i


From: ELPA Syncer
Subject: [elpa] externals/detached 4fb196ab31 2/3: Add public predicates for un/initialized
Date: Fri, 11 Nov 2022 06:57:30 -0500 (EST)

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

    Add public predicates for un/initialized
---
 detached-list.el |  6 +++---
 detached.el      | 19 ++++++++++++-------
 2 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/detached-list.el b/detached-list.el
index 1303b4c97b..a69e728d8e 100644
--- a/detached-list.el
+++ b/detached-list.el
@@ -130,7 +130,7 @@ Optionally initialize ALL session-directories."
   (interactive "P")
   (if-let* ((uninitialized-directories
              (thread-last (detached-get-sessions)
-                          (seq-filter #'detached--uninitialized-session-p)
+                          (seq-filter #'detached-session-uninitialized-p)
                           (seq-map #'detached--session-directory)
                           (seq-uniq))))
       (if all
@@ -791,7 +791,7 @@ If prefix-argument is provided unmark instead of mark."
                 (alist-get 'failure detached-list-state-symbols "?")
               (alist-get 'success detached-list-state-symbols "?"))))
          (status-face
-          (cond ((and (detached--uninitialized-session-p session)
+          (cond ((and (detached-session-uninitialized-p session)
                       (detached-session-active-p session))
                  'detached-identifier-face)
                 ((detached-session-active-p session) 'font-lock-type-face)
@@ -816,7 +816,7 @@ If prefix-argument is provided unmark instead of mark."
 (defun detached-list--command-str (session)
   "Return command string for SESSION."
   (let ((command-str (detached--session-command session)))
-    (if (detached--uninitialized-session-p session)
+    (if (detached-session-uninitialized-p session)
         (propertize command-str 'face 'detached-uninitialized-face)
       command-str)))
 
diff --git a/detached.el b/detached.el
index 953d815407..9e9a47fbbe 100644
--- a/detached.el
+++ b/detached.el
@@ -1001,6 +1001,16 @@ This function uses the `notifications' library."
   "Return t if SESSION is forced to run locally."
   (detached--session-local session))
 
+(defun detached-session-uninitialized-p (session)
+  "Return t if SESSION is uninitialized."
+  (eq 'uninitialized
+      (gethash (detached--session-id session) detached--hashed-sessions)))
+
+(defun detached-session-initialized-p (session)
+  "Return t if SESSION is initialized."
+  (eq 'initialized
+      (gethash (detached--session-id session) detached--hashed-sessions)))
+
 ;;;;; Other
 
 (cl-defgeneric detached--get-session (_mode)
@@ -1448,7 +1458,7 @@ Optionally make the path LOCAL to host."
 
 (defun detached--get-initialized-session (session)
   "Return an initialized copy of SESSION."
-  (if (detached--uninitialized-session-p session)
+  (if (detached-session-uninitialized-p session)
       (progn
         (detached--initialize-session session)
         (detached--db-update-sessions)
@@ -1684,14 +1694,9 @@ session and trigger a state transition."
 
 (defun detached--uninitialized-sessions ()
   "Return a list of uninitialized sessions."
-  (seq-filter #'detached--uninitialized-session-p
+  (seq-filter #'detached-session-uninitialized-p
               (detached--db-get-sessions)))
 
-(defun detached--uninitialized-session-p (session)
-  "Return t if SESSION is uninitialized."
-  (eq 'uninitialized
-      (gethash (detached--session-id session) detached--hashed-sessions)))
-
 (defun detached--db-directory-event (event)
   "Act on EVENT in `detached-db-directory'.
 



reply via email to

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