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

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

[elpa] externals/detached 8cef9a0953 7/9: Add select filter command


From: ELPA Syncer
Subject: [elpa] externals/detached 8cef9a0953 7/9: Add select filter command
Date: Thu, 22 Sep 2022 09:57:37 -0400 (EDT)

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

    Add select filter command
    
    A filter can be composed of multiple narrow criterias.
---
 detached-list.el | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/detached-list.el b/detached-list.el
index b8799098b4..5261dbbfea 100644
--- a/detached-list.el
+++ b/detached-list.el
@@ -49,6 +49,13 @@
   :group 'detached
   :type 'list)
 
+(defcustom detached-list-filters nil
+  "An alist of custom filters that can be applied.
+
+The filters are built using the different narrow functions that
+detached list implements."
+  :group 'detached)
+
 ;;;; Private
 
 (defvar-local detached-list--marked-sessions nil
@@ -204,6 +211,12 @@ Optionally SUPPRESS-OUTPUT."
          (detached--remote-session-p session)))
      ,@detached-list--filters)))
 
+(defun detached-list-select-filter ()
+  "Select a `detached-list-filter' to apply."
+  (interactive)
+  (when-let* ((filter-name (completing-read "Select filter: " 
detached-list-filters))
+              (filter (alist-get filter-name detached-list-filters nil nil 
#'string=)))
+    (seq-do (lambda (it) (apply it)) filter)))
 
 (defun detached-list-narrow-origin (origin)
   "Narrow to sessions with a specific ORIGIN."
@@ -488,6 +501,7 @@ If prefix-argument is provided unmark instead of mark."
 (defvar detached-list-mode-map
   (let ((map (make-sparse-keymap)))
     (define-key map (kbd "d") #'detached-list-delete-session)
+    (define-key map (kbd "f") #'detached-list-select-filter)
     (define-key map (kbd "g") #'detached-list-revert)
     (define-key map (kbd "j") #'detached-list-jump-to-directory)
     (define-key map (kbd "k") #'detached-list-kill-session)



reply via email to

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