diff options
author | Carl Worth <cworth@cworth.org> | 2009-11-04 09:26:50 -0800 |
---|---|---|
committer | Carl Worth <cworth@cworth.org> | 2009-11-04 09:26:50 -0800 |
commit | 33fae33d82baa31f9b6b5dd774ffda76d4d7fcbc (patch) | |
tree | 4575d13c69b5b9f55a8aa2b68004d58a5555a8c2 | |
parent | 278ae86f64a58bd9265441d858916f6f0a22ed18 (diff) |
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.
-rw-r--r-- | notmuch.el | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -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 () |