[PATCH 2/3] emacs: message/thread deletion by adding "deleted" tag

Jameson Graef Rollins jrollins at finestructure.net
Tue Jan 17 11:02:48 PST 2012


---
 emacs/notmuch-show.el |   46 ++++++++++++++++++++++++++++++++++++++++++++++
 emacs/notmuch.el      |    8 ++++++++
 2 files changed, 54 insertions(+), 0 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index c1d721e..141241d 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1506,6 +1506,52 @@ removed)."
   (notmuch-show-archive-message)
   (notmuch-show-next-open-message t))
 
+(defun notmuch-show-delete-thread (&optional undelete)
+  "Delete each message in thread.
+
+Delete each message currently shown by adding the \"deleted\" tag
+to each.  If a prefix argument is given, the messages will be
+\"undeleted\" (ie. the \"deleted\" tag will be removed instead of
+added).
+
+Note: This command is safe from any race condition of new messages
+being delivered to the same thread. It does not archive the
+entire thread, but only the messages shown in the current
+buffer."
+  (interactive)
+  (if undelete
+      (notmuch-show-remove-tag-thread "deleted")
+    (notmuch-show-add-tag-thread "deleted")))
+
+(defun notmuch-show-delete-thread-then-next ()
+  "Delete each message in thread, then show next thread from search."
+  (interactive)
+  (notmuch-show-delete-thread)
+  (notmuch-show-next-thread t))
+
+(defun notmuch-show-delete-thread-then-exit ()
+  "Delete each message in thread, then exit back to search results."
+  (interactive)
+  (notmuch-show-delete-thread)
+  (notmuch-show-next-thread))
+
+(defun notmuch-show-delete-message (&optional undelete)
+  "Delete the current message (add \"deleted\" tag).
+
+If a prefix argument is given, the message will be
+\"undeleted\" (ie. the \"deleted\" tag will be removed instead of
+added)."
+  (interactive)
+  (if undelete
+      (notmuch-show-remove-tag "deleted")
+    (notmuch-show-add-tag "deleted")))
+
+(defun notmuch-show-delete-message-then-next ()
+  "Archive the current message, then show next thread from search."
+  (interactive)
+  (notmuch-show-delete-message)
+  (notmuch-show-next-open-message t))
+
 (defun notmuch-show-stash-cc ()
   "Copy CC field of current message to kill-ring."
   (interactive)
diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 67ecd3a..2acb31b 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -619,6 +619,14 @@ This function advances the next thread when finished."
   (notmuch-search-remove-tag-thread "inbox")
   (notmuch-search-next-thread))
 
+(defun notmuch-search-delete-thread ()
+  "Delete the currently selected thread (add \"deleted\" tag).
+
+This function advances the next thread when finished."
+  (interactive)
+  (notmuch-search-add-tag-thread "deleted")
+  (notmuch-search-next-thread))
+
 (defvar notmuch-search-process-filter-data nil
   "Data that has not yet been processed.")
 (make-variable-buffer-local 'notmuch-search-process-filter-data)
-- 
1.7.7.3



More information about the notmuch mailing list