summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2026-05-25 03:33:26 +0100
committerjao <jao@gnu.org>2026-06-20 17:07:26 +0100
commite0ee7a2d9247762d7f5f1d311b81bbf556d55c0d (patch)
treea62d96592d5672cb227fa14c3ff57821f8f73b86
parentc38cff9d80c6fe1e156eb49767e0c742b32d867f (diff)
downloadelibs-e0ee7a2d9247762d7f5f1d311b81bbf556d55c0d.tar.gz
elibs-e0ee7a2d9247762d7f5f1d311b81bbf556d55c0d.tar.bz2
notmuch
-rw-r--r--custom/jao-custom-notmuch.el36
1 files changed, 24 insertions, 12 deletions
diff --git a/custom/jao-custom-notmuch.el b/custom/jao-custom-notmuch.el
index 4682bfa..90e782d 100644
--- a/custom/jao-custom-notmuch.el
+++ b/custom/jao-custom-notmuch.el
@@ -66,16 +66,26 @@
(defvar jao-notmuch--new-rx nil)
(defvar jao-notmuch--newa nil)
+(defun jao-notmuch--tags-q (tags)
+ (format "tag:\"/^(%s)$/\"" (mapconcat (lambda (s) (format "%s" s)) tags "|")))
+
+(defun jao-notmuch--new (&rest tags)
+ (cond ((listp jao-notmuch--new)
+ (jao-notmuch--tags-q (append jao-notmuch--new tags)))
+ (tags (concat jao-notmuch--new " OR " (jao-notmuch--tags-q tags)))
+ (t jao-notmuch--new)))
+
(defun jao-notmuch--set-new-search (s)
(setq jao-notmuch--new s
- jao-notmuch--new-rx (regexp-quote jao-notmuch--new)
- jao-notmuch--newa (concat jao-notmuch--new " AND ")))
+ jao-notmuch--new-rx (regexp-quote (jao-notmuch--new))
+ jao-notmuch--newa (concat (jao-notmuch--new) " AND ")))
(defun jao-notmuch--q (d0 &optional k d1 qs st)
- (let ((q (or (when qs (mapconcat #'identity qs " AND "))
- (concat jao-notmuch--new
- (mapconcat (lambda (d) (when d (concat " AND tag:" d)))
- (list d0 d1))))))
+ (let* ((qs (when qs (mapconcat #'identity qs " AND ")))
+ (q (or qs
+ (concat (jao-notmuch--new)
+ (mapconcat (lambda (d) (when d (concat " AND tag:" d)))
+ (list d0 d1))))))
(list :name (concat d0 (when (and d1 (not (string= "" d1))) "/") d1)
:key k :query q :search-type (or st 'tree)
:sort-order 'oldest-first)))
@@ -178,16 +188,18 @@
("sg" "gr-qc")
("sq" "quant-ph")))))
-(defun jao-notmuch-define-summary-searches ()
+(defun jao-notmuch-define-flag-searches ()
(jao-notmuch--def-searches "flags"
(jao-notmuch-widen-searches notmuch-saved-searches " AND tag:flagged")
t)
-
(jao-notmuch--def-searches nil
- `(,(jao-notmuch--q "flagged" "F" nil '("tag:flagged"))))
+ `(,(jao-notmuch--q "flagged" "F" nil '("tag:flagged")))))
+
+(defun jao-notmuch-define-summary-searches ()
+ (jao-notmuch-define-flag-searches)
(jao-notmuch--def-searches "today"
- `(,(jao-notmuch--q "new" "N" nil (list jao-notmuch--new "not tag:draft"))
+ `(,(jao-notmuch--q "new" "N" nil (list (jao-notmuch--new) "not tag:draft"))
,(jao-notmuch--q "drafts" "D" nil '("tag:draft") t)
,(jao-notmuch--q "sent" "S" nil '("date:1d.." "tag:sent") t)
,(jao-notmuch--q "today" "T" nil
@@ -196,7 +208,7 @@
t)))
(jao-notmuch--def-searches "trove"
- '((:query "tag:trove" :name "trove" :search-type tree)
+ `((:query "tag:trove" :name "trove" :search-type tree)
(:query "tag:hacking" :name "hacking" :search-type tree)
(:query "not tag:trove and not tag:hacking" :name "untroved"
:search-type tree)
@@ -214,7 +226,7 @@
(when (display-graphic-p)
(add-to-list 'notmuch-hello-sections '(insert " "))))
-(jao-notmuch-define-searches "tag:\"/^(unread|new)$/\"")
+(jao-notmuch-define-searches '(unread new))
(defun jao-notmuch-jump-search (&optional widen)
(interactive "P")