summaryrefslogtreecommitdiffhomepage
path: root/email.org
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2021-04-26 04:07:02 +0100
committerjao <jao@gnu.org>2021-04-26 04:07:02 +0100
commit705ad2cb9c452de23b146be8c6bfc445b0a06aa1 (patch)
tree3aaa376ab260a9ddeb716d3d2b7614c33bad7545 /email.org
parentb82671b0620e9d978fc753f2059fcb2708254dda (diff)
downloadelibs-705ad2cb9c452de23b146be8c6bfc445b0a06aa1.tar.gz
elibs-705ad2cb9c452de23b146be8c6bfc445b0a06aa1.tar.bz2
better jumpy saved searches in notmuch
Diffstat (limited to 'email.org')
-rw-r--r--email.org87
1 files changed, 50 insertions, 37 deletions
diff --git a/email.org b/email.org
index ada0476..50bd73b 100644
--- a/email.org
+++ b/email.org
@@ -380,11 +380,6 @@
#+end_src
*** shared commands
#+begin_src emacs-lisp
- (defun jao-notmuch-saved-search-jump ()
- "Jump to a saved search, using its key, and ensuring minibuffer can grow."
- (interactive)
- (let ((resize-mini-windows t)) (notmuch-jump-search)))
-
(defun jao-notmuch-tag-jump (reverse)
"Create a jump menu for tagging operations, ensuring minibuffer can grow."
(interactive "P")
@@ -400,12 +395,10 @@
(if thread
(notmuch-tree-tag-thread (notmuch-tag-change-list tags reverse))
(notmuch-tree-tag (notmuch-tag-change-list tags reverse)))
- (notmuch-tree-next-matching-message))
-
- (defun jao-notmuch-tree-delete-next (thread)
- "Mark as deleted current message (or thread, with prefix) and move to next."
- (interactive "P")
- (jao-notmuch-tree--tag-next '("+deleted" "-unread" "-new") nil thread))
+ (if thread
+ (notmuch-tree-next-thread)
+ (notmuch-tree-next-matching-message))
+ (notmuch-tree-show-message nil))
(defun jao-notmuch-tree-flagged-next (reverse)
(interactive "P")
@@ -444,35 +437,55 @@
#+end_src
+*** searches
+ #+begin_src emacs-lisp
+ (defun jao-notmuch--and (frags)
+ (when frags (mapconcat #'identity frags " AND ")))
+
+ (defvar jao-notmuch-alt-searches '())
+
+ (defun jao-notmuch-saved-search-jump ()
+ "Jump to a saved search, using its key, for the alt list."
+ (interactive)
+ (let ((resize-mini-windows t)
+ (notmuch-saved-searches jao-notmuch-alt-searches))
+ (notmuch-jump-search)))
+
+ (defun jao-notmuch--q-base (d0 d1 k q)
+ (list :name (concat d0 (when d1 "/") d1)
+ :search-type 'tree :key k :query q))
+
+ (defun jao-notmuch--q (d0 d1 &optional k qs)
+ (when (null qs)
+ (add-to-list 'jao-notmuch-alt-searches
+ (jao-notmuch--q-base d0 d1 k
+ (format "folder:%s/%s" d0 d1))
+ t))
+ (let ((q (or (jao-notmuch--and qs)
+ (format "folder:%s/%s and tag:unread" d0 d1))))
+ (jao-notmuch--q-base d0 d1 nil q)))
+
+ (defun jao-notmuch--mboxes-search (box &rest excluded)
+ (let ((ms (seq-difference (jao-list-mailboxes box) excluded))
+ (bp (substring box 0 1)))
+ (mapcar `(lambda (m)
+ (jao-notmuch--q ,box (car m) (concat ,bp (cdr m))))
+ (shorten-strings (sort ms #'string<)))))
+
+ (setq notmuch-saved-searches
+ `(,(jao-notmuch--q "bigml" "inbox" "bi")
+ ,@(jao-notmuch--mboxes-search "bigml" "inbox" "deploys")
+ ,(jao-notmuch--q "jao" "inbox" "ji")
+ ,@(jao-notmuch--mboxes-search "jao" "inbox")
+ ,@(jao-notmuch--mboxes-search "feeds")
+ ,(jao-notmuch--q "bml/today" nil "tb" '("tag:bigml" "date:1d.."))
+ ,(jao-notmuch--q "jao/today" nil "tj" '("tag:jao" "date:1d.."))
+ ,(jao-notmuch--q "flagged" nil "r" '("tag:flagged"))
+ ,(jao-notmuch--q "new" nil "n" '("tag:new"))))
+ #+end_src
*** hello
#+begin_src emacs-lisp
(use-package notmuch-hello
- :config
- (defun jao-notmuch--and (frags)
- (when frags (mapconcat #'identity frags " AND ")))
-
- (defun jao-notmuch--q (d0 d1 &optional k qs)
- (list :name (concat d0 (when d1 "/") d1) :search-type 'tree :key k
- :query (or (jao-notmuch--and qs)
- (format "folder:%s/%s and tag:unread" d0 d1))))
-
- (defun jao-notmuch--mboxes-search (box &rest excluded)
- (let ((ms (seq-difference (jao-list-mailboxes box) excluded))
- (bp (substring box 0 1)))
- (mapcar `(lambda (m)
- (jao-notmuch--q ,box (car m) (concat ,bp (cdr m))))
- (shorten-strings (sort ms #'string<)))))
-
- (setq notmuch-saved-searches
- `(,(jao-notmuch--q "bigml" "inbox" "bi")
- ,@(jao-notmuch--mboxes-search "bigml" "inbox" "deploys")
- ,(jao-notmuch--q "jao" "inbox" "ji")
- ,@(jao-notmuch--mboxes-search "jao" "inbox")
- ,@(jao-notmuch--mboxes-search "feeds")
- ,(jao-notmuch--q "bml/today" nil "tb" '("tag:bigml" "date:1d.."))
- ,(jao-notmuch--q "jao/today" nil "tj" '("tag:jao" "date:1d.."))
- ,(jao-notmuch--q "flagged" nil "r" '("tag:flagged"))
- ,(jao-notmuch--q "new" nil "n" '("tag:new"))))
:init
(setq notmuch-hello-sections '(notmuch-hello-insert-saved-searches
notmuch-hello-insert-alltags