diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2022-04-29 05:09:52 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2022-04-29 13:58:06 -0700 |
commit | c27a052b3ba46932421c16e219ca3c71d69097e1 (patch) | |
tree | ef0c3ced9f79f28c409ca8c0674577f651bc3bac /.emacs.d | |
parent | 43fcea7597ccda99e2706a5633fa1de593892e35 (diff) | |
download | dotfiles-c27a052b3ba46932421c16e219ca3c71d69097e1.tar.gz |
replace spw/notmuch-query-has-results-p
Diffstat (limited to '.emacs.d')
-rw-r--r-- | .emacs.d/init.el | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/.emacs.d/init.el b/.emacs.d/init.el index e890ebc9..9bce680a 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -2776,17 +2776,6 @@ Two ways to read: (defvar spw/readall nil "Internal cache variable.") -(defun spw/notmuch-query-has-results-p (query) - "Predicate testing whether any messages match notmuch query QUERY." - (length> (process-lines notmuch-command - "search" - "--output=messages" - "--limit=1" - "--format=text" - "--format-version=4" - query) - 0)) - (defun spw/notmuch-show-stable-matching-query () (let (ids) (notmuch-show-mapc @@ -2966,7 +2955,9 @@ Two ways to read: (killp (not (eq :archive catchup-method)))) ;; If any messages match `spw/readall' then for safety user must call ;; `spw/kill-thread', which has a harder-to-press binding. - (when (spw/notmuch-query-has-results-p (spw/nm& thread-id spw/readall)) + (unless (zerop + (string-to-number + (notmuch-saved-search-count (spw/nm& thread-id spw/readall)))) (user-error "Some messages in thread match `spw/readall'")) ;; Catchup only the messages that were matched by the saved search. (notmuch-tag message-ids '("-unread")) @@ -3004,8 +2995,11 @@ Two ways to read: ;; because that might be out-of-date if the thread was archived from ;; `notmuch-show-mode' rather than this buffer, and we can't refresh ;; the buffer as we don't want to kill any newly-arrived threads - (when (spw/notmuch-query-has-results-p - (spw/nm& "tag:unread" (car (notmuch-search-find-stable-query)))) + (unless + (zerop + (string-to-number + (notmuch-saved-search-count + (spw/nm& "tag:unread" (car (notmuch-search-find-stable-query)))))) (ignore-error user-error (spw/maybe-kill-thread))) (notmuch-search-next-thread)) (spw/next-unread-group))) |