[PATCH 3/4] emacs: add ability to "delete" messages and threads
authorJameson Graef Rollins <jrollins@finestructure.net>
Sat, 7 Jan 2012 22:28:13 +0000 (14:28 +1600)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:41:43 +0000 (09:41 -0800)
7d/92511aabe945ad0de0b1703cffa0b608d10145 [new file with mode: 0644]

diff --git a/7d/92511aabe945ad0de0b1703cffa0b608d10145 b/7d/92511aabe945ad0de0b1703cffa0b608d10145
new file mode 100644 (file)
index 0000000..4871111
--- /dev/null
@@ -0,0 +1,134 @@
+Return-Path: <jrollins@finestructure.net>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id F2B4A40EF50\r
+       for <notmuch@notmuchmail.org>; Sat,  7 Jan 2012 14:28:26 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -2.3\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id d2ZcLm6YfchD for <notmuch@notmuchmail.org>;\r
+       Sat,  7 Jan 2012 14:28:26 -0800 (PST)\r
+Received: from outgoing-mail.its.caltech.edu (outgoing-mail.its.caltech.edu\r
+       [131.215.239.19])\r
+       by olra.theworths.org (Postfix) with ESMTP id C6BDB40F1AB\r
+       for <notmuch@notmuchmail.org>; Sat,  7 Jan 2012 14:28:23 -0800 (PST)\r
+Received: from earth-doxen.imss.caltech.edu (localhost [127.0.0.1])\r
+       by earth-doxen-postvirus (Postfix) with ESMTP id 5C6D266E00D8\r
+       for <notmuch@notmuchmail.org>; Sat,  7 Jan 2012 14:28:23 -0800 (PST)\r
+X-Spam-Scanned: at Caltech-IMSS on earth-doxen by amavisd-new\r
+Received: from finestructure.net (cpe-76-174-137-84.socal.res.rr.com\r
+       [76.174.137.84]) (Authenticated sender: jrollins)\r
+       by earth-doxen-submit (Postfix) with ESMTP id 5F84E66E00BD\r
+       for <notmuch@notmuchmail.org>; Sat,  7 Jan 2012 14:28:21 -0800 (PST)\r
+Received: by finestructure.net (Postfix, from userid 1000)\r
+       id D54E71165; Sat,  7 Jan 2012 14:28:20 -0800 (PST)\r
+From: Jameson Graef Rollins <jrollins@finestructure.net>\r
+To: Notmuch Mail <notmuch@notmuchmail.org>\r
+Subject: [PATCH 3/4] emacs: add ability to "delete" messages and threads\r
+Date: Sat,  7 Jan 2012 14:28:13 -0800\r
+Message-Id: <1325975294-646-4-git-send-email-jrollins@finestructure.net>\r
+X-Mailer: git-send-email 1.7.7.3\r
+In-Reply-To: <1325975294-646-3-git-send-email-jrollins@finestructure.net>\r
+References: <1325975294-646-1-git-send-email-jrollins@finestructure.net>\r
+       <1325975294-646-2-git-send-email-jrollins@finestructure.net>\r
+       <1325975294-646-3-git-send-email-jrollins@finestructure.net>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sat, 07 Jan 2012 22:28:27 -0000\r
+\r
+This completely mimics the behavior of archiving, but instead of\r
+remove the inbox tag it add the "deleted" tag.  The functionality is\r
+bound to the 'd' key in both search and show mode.\r
+\r
+Note: this does *not* actually delete any messages.  That is still\r
+left entirely up to the user to figure out how they want to handle\r
+that.  This *just* adds the "deleted" tag to messages, no more.  If\r
+the notmuch-search-exclude-deleted config variable is set, though,\r
+"deleted" messages will be excluded from search results.\r
+---\r
+ emacs/notmuch-show.el |   15 +++++++++++++++\r
+ emacs/notmuch.el      |   12 ++++++++++++\r
+ 2 files changed, 27 insertions(+), 0 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+index 1e16f05..e1d15f4 100644\r
+--- a/emacs/notmuch-show.el\r
++++ b/emacs/notmuch-show.el\r
+@@ -944,6 +944,7 @@ thread id.  If a prefix is given, crypto processing is toggled."\r
+       (define-key map "+" 'notmuch-show-add-tag)\r
+       (define-key map "x" 'notmuch-show-archive-thread-then-exit)\r
+       (define-key map "a" 'notmuch-show-archive-thread)\r
++      (define-key map "d" 'notmuch-show-delete-thread)\r
+       (define-key map "N" 'notmuch-show-next-message)\r
+       (define-key map "P" 'notmuch-show-previous-message)\r
+       (define-key map "n" 'notmuch-show-next-open-message)\r
+@@ -1454,6 +1455,20 @@ buffer."\r
+   (interactive)\r
+   (notmuch-show-tag-thread-internal "-" "inbox" nil))\r
\r
++(defun notmuch-show-delete-thread ()\r
++  "Delete each message in thread, then show next thread from search.\r
++\r
++Delete each message currently shown by adding the \"deleted\"\r
++tag to each. Then kill this buffer and show the next thread\r
++from the search from which this thread was originally shown.\r
++\r
++Note: This command is safe from any race condition of new messages\r
++being delivered to the same thread. It does not archive the\r
++entire thread, but only the messages shown in the current\r
++buffer."\r
++  (interactive)\r
++  (notmuch-show-tag-thread-internal "+" "deleted" t))\r
++\r
+ (defun notmuch-show-stash-cc ()\r
+   "Copy CC field of current message to kill-ring."\r
+   (interactive)\r
+diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
+index c519687..2b860f4 100644\r
+--- a/emacs/notmuch.el\r
++++ b/emacs/notmuch.el\r
+@@ -218,6 +218,7 @@ For a mouse binding, return nil."\r
+     (define-key map [mouse-1] 'notmuch-search-show-thread)\r
+     (define-key map "*" 'notmuch-search-operate-all)\r
+     (define-key map "a" 'notmuch-search-archive-thread)\r
++    (define-key map "d" 'notmuch-search-delete-thread)\r
+     (define-key map "-" 'notmuch-search-remove-tag)\r
+     (define-key map "+" 'notmuch-search-add-tag)\r
+     (define-key map (kbd "RET") 'notmuch-search-show-thread)\r
+@@ -605,6 +606,17 @@ This function advances the next thread when finished."\r
+   (notmuch-search-remove-tag-thread "inbox")\r
+   (forward-line))\r
\r
++(defun notmuch-search-delete-thread ()\r
++  "Delete the currently selected thread (add the \"deleted\" tag).\r
++\r
++This function advances the next thread when finished.\r
++\r
++If notmuch-search-exclude-deleted is set, \"deleted\" messages\r
++will be excluded from searches."\r
++  (interactive)\r
++  (notmuch-search-add-tag "deleted")\r
++  (forward-line))\r
++\r
+ (defvar notmuch-search-process-filter-data nil\r
+   "Data that has not yet been processed.")\r
+ (make-variable-buffer-local 'notmuch-search-process-filter-data)\r
+-- \r
+1.7.7.3\r
+\r