]> git.notmuchmail.org Git - notmuch/blobdiff - emacs/notmuch.el
emacs: add support for custom tag changes on message/thread archive
[notmuch] / emacs / notmuch.el
index 7b61e9be13e868f7a0653bd927c6fee82cbcc26a..64caa3eaf2e5a9b73c79b38634ba9f398d9ff083 100644 (file)
@@ -388,8 +388,9 @@ any tags).
 Pressing \\[notmuch-search-show-thread] on any line displays that thread. The '\\[notmuch-search-add-tag]' and '\\[notmuch-search-remove-tag]'
 keys can be used to add or remove tags from a thread. The '\\[notmuch-search-archive-thread]' key
 is a convenience for archiving a thread (removing the \"inbox\"
-tag). The '\\[notmuch-search-tag-all]' key can be used to add or remove a tag from all
-threads in the current buffer.
+tag). The '\\[notmuch-search-tag-all]' key can be used to add and/or remove tags from all
+messages (as opposed to threads) that match the current query.  Use with caution, as this
+will also tag matching messages that arrived *after* constructing the buffer.
 
 Other useful commands are '\\[notmuch-search-filter]' for filtering the current search
 based on an additional query string, '\\[notmuch-search-filter-by-tag]' for filtering to include
@@ -593,11 +594,19 @@ See `notmuch-tag' for information on the format of TAG-CHANGES."
   (notmuch-search-tag "-"))
 
 (defun notmuch-search-archive-thread ()
-  "Archive the currently selected thread (remove its \"inbox\" tag).
+  "Archive the currently selected thread.
+
+Archive each message in the currently selected thread by applying
+the tag changes in `notmuch-archive-tags' to each (remove the
+\"inbox\" tag by default). If a prefix argument is given, the
+messages will be \"unarchived\" (i.e. the tag changes in
+`notmuch-archive-tags' will be reversed).
 
 This function advances the next thread when finished."
   (interactive)
-  (notmuch-search-tag '("-inbox"))
+  (when notmuch-archive-tags
+    (notmuch-search-tag
+     (notmuch-tag-change-list notmuch-archive-tags)))
   (notmuch-search-next-thread))
 
 (defun notmuch-search-update-result (result &optional pos)