Very happy with the overall ideas. On Tue, 17 Jan 2012 10:05:26 -0800, Jameson Graef Rollins wrote: > -(defun notmuch-show-archive-thread-internal (show-next) > - ;; Remove the tag from the current set of messages. > +(defun notmuch-show-tag-thread-internal (tag &optional remove) > + ;; Add tag to the current set of messages. If the remove switch is > + ;; given, tags will be removed instead of added. > (goto-char (point-min)) > - (loop do (notmuch-show-remove-tag "inbox") > - until (not (notmuch-show-goto-message-next))) > - ;; Move to the next item in the search results, if any. > + (let ((tag-function 'notmuch-show-add-tag)) > + (if remove > + (setq tag-function 'notmuch-show-remove-tag)) This seems odd. How about: (let ((tag-function (if remove 'notmuch-show-remove-tag 'notmuch-show-add-tag))) ... > + (loop do (funcall tag-function tag) > + until (not (notmuch-show-goto-message-next))))) Otherwise good.