diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2020-05-06 08:24:26 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2020-05-06 08:24:26 -0700 |
commit | 556b5bb85c84954e90f3caff417959233b2c2124 (patch) | |
tree | a08430fd86cfa92a02db49b72aace3f73872f55a /.emacs.d/init.el | |
parent | 6308f521b849c2c9d011fc51f7be8eed41b9d643 (diff) | |
download | dotfiles-556b5bb85c84954e90f3caff417959233b2c2124.tar.gz |
spw--notmuch-tree-catchup: never mark readall mail as read
Now catchup can be used a bit more freely.
Diffstat (limited to '.emacs.d/init.el')
-rw-r--r-- | .emacs.d/init.el | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/.emacs.d/init.el b/.emacs.d/init.el index aabde46c..1e84a1a0 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -1051,6 +1051,8 @@ Two ways to read: (defvar spw--lists-browse-searches nil "notmuch queries for reading some lists like newsgroups.") + (defvar spw--readall nil + "notmuch query matching mail where I want to read every message.") (defun spw--standard-notmuch-saved-searches () (interactive) (setq notmuch-saved-searches nil @@ -1082,10 +1084,10 @@ Two ways to read: (plist-get search :query) ")")) t)))) + (setq spw--readall (spw--disjoin-queries "folder:inbox" spw--lists-readall)) + ;; now prepend views for processing the day's mail addressed to me - (let* ((readall (spw--disjoin-queries spw--lists-readall)) - (to-process (concat "tag:unread and " - "(folder:inbox or " readall ")")) + (let* ((to-process (concat "tag:unread and (" spw--readall ")")) (to-process-weekend (concat to-process " and not (" spw--weekday-only-mail ")"))) (add-to-list 'notmuch-saved-searches @@ -1318,17 +1320,19 @@ Two ways to read: (use-package notmuch-tree :commands notmuch-tree :config - ;; use on views produced by `spw--next-unread-group', and only after - ;; emptying weekday unread view, so that messages which fall into - ;; both `spw--lists-readall' and the current view will not - ;; accidentally get marked as read + ;; use on views produced by `spw--next-unread-group' (defun spw--notmuch-tree-catchup () (interactive) (when (and (eq major-mode 'notmuch-tree-mode) - (y-or-n-p (concat "Are you sure you want to mark all as read?" - " (should be used only after emptying" - " weekday unread view)"))) - (notmuch-tag (notmuch-tree-get-query) '("-unread")) + (y-or-n-p "Are you sure you want to mark all as read?") + (bound-and-true-p spw--readall)) + (notmuch-tag (concat + "(" + (notmuch-tree-get-query) + ") and not (" + spw--readall + ")") + '("-unread")) (notmuch-refresh-this-buffer))) (bind-key "C" 'spw--notmuch-tree-catchup notmuch-tree-mode-map) |