~niklaseklund/detached.el

[PATCH] Fix detached-consult-session crash due to wrong item data

Details
Message ID
<CAM-j=qsnjw4=9kYbYGGR1oqC7BGxmZphN5Jq2gHdO3p8nQYdTw@mail.gmail.com>
DKIM signature
missing
Download raw message
The items generated did not conform with the annotation function
argument requirements. The items generated contained sessions and not
session ids.
---
 detached-consult.el | 38 ++++++++++++++++++++++----------------
 1 file changed, 22 insertions(+), 16 deletions(-)

diff --git a/detached-consult.el b/detached-consult.el
index 5c6bf89..1057e3b 100644
--- a/detached-consult.el
+++ b/detached-consult.el
@@ -97,8 +97,9 @@ See `consult-multi' for a description of the source values."
             ,(lambda ()
                (mapcar #'car
                        (thread-last (detached-session-candidates
(detached-get-sessions))
-                                    (seq-map #'cdr)
-                                    (seq-filter
#'detached-session-active-p)))))
+                                    (seq-filter
+                                     (lambda (alist-item)
+                                       (detached-session-active-p
(cdr alist-item))))))))
   "Active `detached' sessions as a source for `consult'.")

 (defvar detached-consult--source-inactive-session
@@ -111,8 +112,9 @@ See `consult-multi' for a description of the source values."
             ,(lambda ()
                (mapcar #'car
                        (thread-last (detached-session-candidates
(detached-get-sessions))
-                                    (seq-map #'cdr)
-                                    (seq-filter
#'detached-session-inactive-p)))))
+                                    (seq-filter
+                                     (lambda (alist-item)
+                                       (detached-session-inactive-p
(cdr alist-item))))))))
   "Inactive `detached' sessions as a source for `consult'.")

 (defvar detached-consult--source-failure-session
@@ -125,8 +127,9 @@ See `consult-multi' for a description of the source values."
             ,(lambda ()
                (mapcar #'car
                        (thread-last (detached-session-candidates
(detached-get-sessions))
-                                    (seq-map #'cdr)
-                                    (seq-filter
#'detached-session-failed-p)))))
+                                    (seq-filter
+                                     (lambda (alist-item)
+                                       (detached-session-failed-p
(cdr alist-item))))))))
   "Failed `detached' sessions as a source for `consult'.")

 (defvar detached-consult--source-success-session
@@ -139,8 +142,9 @@ See `consult-multi' for a description of the source values."
             ,(lambda ()
                (mapcar #'car
                        (thread-last (detached-session-candidates
(detached-get-sessions))
-                                    (seq-map #'cdr)
-                                    (seq-remove
#'detached-session-failed-p)))))
+                                    (seq-remove
+                                     (lambda (alist-item)
+                                       (detached-session-failed-p
(cdr alist-item))))))))
   "Successful `detached' sessions as a source for `consult'.")

 (defvar detached-consult--source-local-session
@@ -153,9 +157,10 @@ See `consult-multi' for a description of the
source values."
             ,(lambda ()
                (mapcar #'car
                        (thread-last (detached-session-candidates
(detached-get-sessions))
-                                    (seq-map #'cdr)
-                                    (seq-filter
#'detached-session-localhost-p))))
-            "Local host `detached' sessions as a source for `consult'."))
+                                    (seq-filter
+                                     (lambda (alist-item)
+                                       (detached-session-localhost-p
(cdr alist-item))))))))
+            "Local host `detached' sessions as a source for `consult'.")

 (defvar detached-consult--source-remote-session
   `(:narrow (?r . "Remote Host")
@@ -167,8 +172,9 @@ See `consult-multi' for a description of the source values."
             ,(lambda ()
                (mapcar #'car
                        (thread-last (detached-session-candidates
(detached-get-sessions))
-                                    (seq-map #'cdr)
-                                    (seq-filter
#'detached-session-remotehost-p)))))
+                                    (seq-filter
+                                     (lambda (alist-item)
+                                       (detached-session-remotehost-p
(cdr alist-item))))))))
   "Remote host `detached' sessions as a source for `consult'.")

 (defvar detached-consult--source-current-session
@@ -182,10 +188,10 @@ See `consult-multi' for a description of the
source values."
                (let ((host-name (car (detached--host))))
                  (mapcar #'car
                          (thread-last (detached-session-candidates
(detached-get-sessions))
-                                      (seq-map #'cdr)
                                       (seq-filter
-                                       (lambda (x)
-                                         (string=
(detached-session-host-name x) host-name))))))))
+                                       (lambda (alist-item)
+                                         (string=
(detached-session-host-name (cdr alist-item))
+                                                  host-name))))))))
   "Current host `detached' sessions as a source for `consult'.")

 ;;;; Commands
-- 
2.34.5
Reply to thread Export thread (mbox)