From 33fae33d82baa31f9b6b5dd774ffda76d4d7fcbc Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Wed, 4 Nov 2009 09:26:50 -0800 Subject: [PATCH] notmuch.el: Make archive-thread more efficient for already archived messages. The approach here is to move the optimization from mark-read to the more general remove-tag. Namely, don't call out to a "notmuch tag" command to remove a tag that's not there already. --- notmuch.el | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/notmuch.el b/notmuch.el index 07f54779..8e752198 100644 --- a/notmuch.el +++ b/notmuch.el @@ -95,8 +95,11 @@ (defun notmuch-show-remove-tag (tag) (interactive "sTag to remove: ") - (notmuch-call-notmuch-process "tag" (concat "-" tag) (concat "id:" (notmuch-show-get-message-id))) - (notmuch-show-set-tags (delete tag (notmuch-show-get-tags)))) + (let ((tags (notmuch-show-get-tags))) + (if (member tag tags) + (progn + (notmuch-call-notmuch-process "tag" (concat "-" tag) (concat "id:" (notmuch-show-get-message-id))) + (notmuch-show-set-tags (delete tag tags)))))) (defun notmuch-show-archive-thread () "Archive each message currrently shown by removing the \"inbox\" tag from each. @@ -178,8 +181,7 @@ simply move to the beginning of the current message." (defun notmuch-show-mark-read-then-next-message () "Remove unread tag from current message, then advance to next message." (interactive) - (if (member "unread" (notmuch-show-get-tags)) - (notmuch-show-remove-tag "unread")) + (notmuch-show-remove-tag "unread") (notmuch-show-next-message)) (defun notmuch-show-advance-marking-read-and-archiving () -- 2.26.2