summaryrefslogtreecommitdiffhomepage
path: root/notmuch.org
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2021-07-26 23:43:40 +0100
committerjao <jao@gnu.org>2021-07-26 23:43:40 +0100
commit258c46bbdda48a851ecde5099acebf5a1a4bd0f5 (patch)
treeae0570af6b1cf8e305e4edb9057dea82aca235f6 /notmuch.org
parent21e519036f0672a95c344137800f78c38b18f761 (diff)
downloadelibs-258c46bbdda48a851ecde5099acebf5a1a4bd0f5.tar.gz
elibs-258c46bbdda48a851ecde5099acebf5a1a4bd0f5.tar.bz2
notmuch: search widening
Diffstat (limited to 'notmuch.org')
-rw-r--r--notmuch.org49
1 files changed, 38 insertions, 11 deletions
diff --git a/notmuch.org b/notmuch.org
index ecf3dd8..728851d 100644
--- a/notmuch.org
+++ b/notmuch.org
@@ -53,15 +53,21 @@
("tags" . "(%s)"))
notmuch-unthreaded-result-format notmuch-tree-result-format)
+ (defvar jao-notmuch--new "tag:\"/^(unread|new)$/\"")
+ (defvar jao-notmuch--newa (concat jao-notmuch--new " AND "))
+
(defun jao-notmuch--q (d0 d1 &optional k qs st)
(let ((q (or (when qs (mapconcat #'identity qs " AND "))
- (concat "tag:\"/^(unread|new)$/\" AND "
+ (concat jao-notmuch--newa
(mapconcat (lambda (d) (when d (concat "tag:" d)))
(list d0 d1) " AND ")))))
(list :name (concat d0 (when d1 "/") d1)
:key k :query q :search-type (or st 'tree)
:sort-order 'oldest-first)))
+ (defun jao-notmuch--qn (d0 d1 k qs &optional st)
+ (jao-notmuch--q d0 d1 k (cons jao-notmuch--new qs) st))
+
(defun jao-notmuch--mboxes-search (box &rest excluded)
(let ((ms (seq-difference (jao-list-mailboxes box) excluded))
(bp (substring box 0 1)))
@@ -74,23 +80,40 @@
,(jao-notmuch--q "bigml" "bug" "bb")
,@(jao-notmuch--mboxes-search "bigml" "inbox" "support")
,@(jao-notmuch--mboxes-search "jao")
- ,(jao-notmuch--q "feeds" "papers" "fp" '("tag:papers" "tag:new"))
- ,(jao-notmuch--q "local" nil "l" '("tag:local" "tag:new"))
- ,(jao-notmuch--q "emacs" "feeds" "ee"
- '("tag:new" "tag:emacs" "not tag:\"/^emacs-/\""))
- ,(jao-notmuch--q "emacs" "github" "eg" '("tag:new" "tag:emacs-github"))
- ,(jao-notmuch--q "emacs" "devel" "ed" '("tag:new" "tag:emacs-devel"))
- ,(jao-notmuch--q "emacs" "bugs" "eb" '("tag:new" "tag:emacs-bugs"))
- ,(jao-notmuch--q "emacs" "diffs" "ec" '("tag:new" "tag:emacs-diffs"))
+ ,(jao-notmuch--qn "feeds" "papers" "fp" '("tag:papers"))
+ ,(jao-notmuch--qn "local" nil "l" '("tag:local"))
+ ,(jao-notmuch--qn "emacs" "feeds" "ee"
+ '("tag:emacs" "not tag:\"/^emacs-/\""))
+ ,(jao-notmuch--qn "emacs" "github" "eg" '("tag:emacs-github"))
+ ,(jao-notmuch--qn "emacs" "devel" "ed" '("tag:emacs-devel"))
+ ,(jao-notmuch--qn "emacs" "bugs" "eb" '("tag:emacs-bugs"))
+ ,(jao-notmuch--qn "emacs" "diffs" "ec" '("tag:emacs-diffs"))
,@(jao-notmuch--mboxes-search "feeds" "emacs")
,(jao-notmuch--q "bml" "today" "tb" '("tag:bigml" "date:1d..") t)
,(jao-notmuch--q "jao" "today" "tj"
'("tag:jao" "date:1d.."
- "not tag:\"/(feeds|spam)/\"")
+ "not tag:\"/(feeds|spam|local)/\"")
t)
- ,(jao-notmuch--q "flagged" nil "r" '("tag:flagged") t)
+ ,(jao-notmuch--q "bml" "flagged" "rb" '("tag:flagged" "tag:bigml") t)
+ ,(jao-notmuch--q "jao" "flagged" "rj" '("tag:flagged" "not tag:bigml") t)
,(jao-notmuch--q "new" nil "n" '("tag:new"))
,(jao-notmuch--q "draft" nil "d" '("tag:draft"))))
+
+ (defun jao-notmuch-widen-searches (searches)
+ (mapcar (lambda (s)
+ (let ((q (plist-get s :query)))
+ (plist-put s :query (string-replace jao-notmuch--newa "" q))))
+ searches))
+
+ (defvar jao-notmuch-widened-searches
+ (jao-notmuch-widen-searches notmuch-saved-searches))
+
+ (defun jao-notmuch-jump-search (&optional widen)
+ (interactive "P")
+ (let ((notmuch-saved-searches
+ (if widen jao-notmuch-widened-searches notmuch-saved-searches)))
+ (notmuch-jump-search)))
+
#+end_src
* enclosures
#+begin_src emacs-lisp
@@ -191,6 +214,7 @@
:bind (:map notmuch-hello-mode-map
(("a" . jao-notmuch-refresh-agenda)
+ ("j" . jao-notmuch-jump-search)
("n" . widget-forward)
("p" . widget-backward)
("S" . consult-notmuch)
@@ -239,6 +263,9 @@
("n" . jao-notmuch-tree-next)
("s" . jao-notmuch-tree-spam)
("u" . jao-notmuch-tree-flag)
+ ("v" . notmuch-tree-scroll-message-window)
+ ("V" . notmuch-tree-scroll-message-window-back)
+ ("/" . notmuch-tree-view-raw-message)
("RET" . jao-notmuch-tree-show-or-scroll)
("SPC" . jao-notmuch-tree-scroll-or-next))
:map notmuch-show-mode-map