]> git.notmuchmail.org Git - notmuch/commitdiff
notmuch.el: Make archive-thread more efficient for already archived messages.
authorCarl Worth <cworth@cworth.org>
Wed, 4 Nov 2009 17:26:50 +0000 (09:26 -0800)
committerCarl Worth <cworth@cworth.org>
Wed, 4 Nov 2009 17:26:50 +0000 (09:26 -0800)
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

index 07f5477986b8cc367c153d619f2450a9c33baf92..8e752198f240cd1e98f8e5c9628a316fdf2877e9 100644 (file)
 
 (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 ()