From f794be35313b18a71434276d2cf2edfa23c8f6d1 Mon Sep 17 00:00:00 2001 From: jao Date: Fri, 20 May 2022 23:18:13 +0100 Subject: notmuch: flagged searches --- notmuch.org | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/notmuch.org b/notmuch.org index 340a114..89b30fb 100644 --- a/notmuch.org +++ b/notmuch.org @@ -111,6 +111,12 @@ '("tag:hacking" "not tag:\"/emacs/\"")) ,(jao-notmuch--qn "jao" "local" "jl" '("tag:local")))) + (defvar jao-notmuch-mark-searches + `(,(jao-notmuch--q "jao" "drafts" "d" '("tag:draft")) + ,(jao-notmuch--q "bml" "flagged" "rb" '("tag:flagged" "tag:bigml")) + ,(jao-notmuch--q "jao" "flagged" "rj" '("tag:flagged" "tag:jao")) + ,(jao-notmuch--q "feeds" "flagged" "rf" '("tag:flagged" "tag:feeds")))) + (defvar jao-notmuch-emacs-searches `(,(jao-notmuch--sq "emacs" "ee" "emacs" "feeds") ,(jao-notmuch--sq "emacs-github" "eg" "emacs" "github") @@ -122,21 +128,18 @@ (setq notmuch-saved-searches (append jao-notmuch-inbox-searches jao-notmuch-bigml-searches + jao-notmuch-mark-searches jao-notmuch-feed-searches jao-notmuch-emacs-searches)) (defvar jao-notmuch-dynamic-searches `(,(jao-notmuch--q "bml" "today" "tb" '("tag:bigml" "date:24h..")) - ,(jao-notmuch--q "bml" "flagged" "rb" '("tag:flagged" "tag:bigml")) ,(jao-notmuch--q "jao" "today" "tj" '("tag:jao" "date:24h.." - "not tag:\"/(feeds|spam|local)/\"")) - ,(jao-notmuch--q "jao" "flagged" "rj" '("tag:flagged" "tag:jao")) - ,(jao-notmuch--q "feeds" "flagged" "rf" '("tag:flagged" "tag:feeds")))) + "not tag:\"/(feeds|spam|local)/\"")))) (defvar jao-notmuch-new-searches - `(,(jao-notmuch--q "jao" "drafts" "d" '("tag:draft")) - ,(jao-notmuch--q "new" nil "nn" '("tag:new" "not tag:draft")) + `(,(jao-notmuch--q "new" nil "nn" '("tag:new" "not tag:draft")) ,(jao-notmuch--q "unread" nil "nu" '("tag:unread")) (:query "*" :name "messages"))) @@ -147,16 +150,21 @@ (notmuch-tree-close-message-window) (notmuch-tree (string-replace jao-notmuch--newa "" query))))) - (defun jao-notmuch-widen-searches (searches) + (defun jao-notmuch-widen-searches (searches &optional extra) (mapcar (lambda (s) - (let ((q (plist-get s :query))) - (plist-put (copy-sequence s) - :query (string-replace jao-notmuch--newa "" q)))) + (let* ((q (plist-get s :query)) + (qs (string-replace jao-notmuch--newa "" q))) + (plist-put (copy-sequence s) :query (concat qs extra)))) searches)) (defvar jao-notmuch-widened-searches (jao-notmuch-widen-searches notmuch-saved-searches)) + (defvar jao-notmuch-flagged-searches + (let ((s (seq-difference notmuch-saved-searches + jao-notmuch-mark-searches))) + (jao-notmuch-widen-searches s " AND tag:flagged"))) + (defun jao-notmuch-jump-search (&optional widen) (interactive "P") (let ((notmuch-saved-searches @@ -251,6 +259,10 @@ (defun jao-notmuch-hello-insert-bigml-searches () (jao-notmuch-hello--insert-searches jao-notmuch-bigml-searches "bigml")) + (defun jao-notmuch-hello-insert-mark-searches () + (jao-notmuch-hello--insert-searches jao-notmuch-mark-searches "marks") + (jao-notmuch-hello--insert-searches jao-notmuch-flagged-searches nil)) + (defun jao-notmuch-hello-insert-feeds-searches () (jao-notmuch-hello--insert-searches jao-notmuch-feed-searches "feeds")) @@ -315,6 +327,7 @@ jao-notmuch-hello-insert-inbox-searches jao-notmuch-hello-insert-feeds-searches jao-notmuch-hello-insert-emacs-searches + jao-notmuch-hello-insert-mark-searches jao-notmuch-hello-insert-dynamic-searches notmuch-hello-insert-alltags) notmuch-hello-hide-tags nil -- cgit v1.2.3