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.
This commit is contained in:
Carl Worth 2009-11-04 09:26:50 -08:00
parent 278ae86f64
commit 33fae33d82

View file

@ -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 ()