   "y T" #'notmuch-show-stash-tags
   "y t" #'notmuch-show-stash-to)
 
-(defun pjones:notmuch-delete-thread (&optional undelete beg end)
-  "Delete messages between BEG and END.
-
-If UNDELETE is non-nil then reverse the delete operation."
-  (interactive (cons current-prefix-arg (notmuch-interactive-region)))
-  (let* ((tags '("+deleted" "-unread" "+move"))
-         (query (notmuch-tag-change-list tags undelete)))
+(defun pjones:notmuch-tag-thread (&optional tags reverse beg end)
+  "Tag selected messages (between BEG and END) with TAGS.
+If REVERSE is non-nil then reverse the tagging operation."
+  (interactive
+   (list
+    (notmuch-search-interactive-tag-changes)
+    current-prefix-arg
+    (notmuch-interactive-region)))
+  (let ((query (notmuch-tag-change-list tags reverse)))
     (pcase major-mode
       ('notmuch-search-mode
        (notmuch-search-tag query)

      ('notmuch-show-mode
       (apply #'notmuch-show-tag-message query)
       (unless (notmuch-show-next-open-message) (notmuch-show-next-thread t))))))

(defun pjones:notmuch-mail-folders (&optional keep)
  "Return a list of valid folder names.

     "gR" #'notmuch-poll-and-refresh-this-buffer
     "gr" #'notmuch-refresh-this-buffer
     "H" #'notmuch-help
     "J" #'pjones:notmuch-mark-read
     "M" #'pjones:notmuch-move-message
     "q" #'notmuch-bury-or-kill-this-buffer
     "s" #'notmuch-search
