- (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 (if remove
+ 'notmuch-show-remove-tag
+ 'notmuch-show-add-tag)))
+ (loop do (funcall tag-function tag)
+ until (not (notmuch-show-goto-message-next)))))
+
+(defun notmuch-show-add-tag-thread (tag)
+ "Add tag to all messages in the current thread."
+ (interactive)
+ (notmuch-show-tag-thread-internal tag))
+
+(defun notmuch-show-remove-tag-thread (tag)
+ "Remove tag from all messages in the current thread."
+ (interactive)
+ (notmuch-show-tag-thread-internal tag t))
+
+(defun notmuch-show-next-thread (&optional show-next)
+ "Move to the next item in the search results, if any."
+ (interactive "P")