Re: Flat search and threaded views
[notmuch-archives.git] / 72 / 52dfecb295762b27a6628e2b6aa0f16e8fcf1f
1 Return-Path: <jrollins@finestructure.net>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 199C5421192\r
6         for <notmuch@notmuchmail.org>; Tue, 17 Jan 2012 11:02:53 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -2.3\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id XL+nz9azDnXJ for <notmuch@notmuchmail.org>;\r
16         Tue, 17 Jan 2012 11:02:52 -0800 (PST)\r
17 Received: from outgoing-mail.its.caltech.edu (outgoing-mail.its.caltech.edu\r
18         [131.215.239.19])\r
19         by olra.theworths.org (Postfix) with ESMTP id 24BA2421189\r
20         for <notmuch@notmuchmail.org>; Tue, 17 Jan 2012 11:02:52 -0800 (PST)\r
21 Received: from earth-doxen.imss.caltech.edu (localhost [127.0.0.1])\r
22         by earth-doxen-postvirus (Postfix) with ESMTP id B5B8266E0183\r
23         for <notmuch@notmuchmail.org>; Tue, 17 Jan 2012 11:02:51 -0800 (PST)\r
24 X-Spam-Scanned: at Caltech-IMSS on earth-doxen by amavisd-new\r
25 Received: from finestructure.net (cpe-76-174-137-84.socal.res.rr.com\r
26         [76.174.137.84]) (Authenticated sender: jrollins)\r
27         by earth-doxen-submit (Postfix) with ESMTP id D1C7B66E016C\r
28         for <notmuch@notmuchmail.org>; Tue, 17 Jan 2012 11:02:49 -0800 (PST)\r
29 Received: by finestructure.net (Postfix, from userid 1000)\r
30         id 7B24752B; Tue, 17 Jan 2012 11:02:49 -0800 (PST)\r
31 From: Jameson Graef Rollins <jrollins@finestructure.net>\r
32 To: Notmuch Mail <notmuch@notmuchmail.org>\r
33 Subject: [PATCH 2/3] emacs: message/thread deletion by adding "deleted" tag\r
34 Date: Tue, 17 Jan 2012 11:02:48 -0800\r
35 Message-Id: <1326826969-23545-2-git-send-email-jrollins@finestructure.net>\r
36 X-Mailer: git-send-email 1.7.7.3\r
37 In-Reply-To: <1326826969-23545-1-git-send-email-jrollins@finestructure.net>\r
38 References: <87vcoaywyu.fsf@servo.finestructure.net>\r
39         <1326826969-23545-1-git-send-email-jrollins@finestructure.net>\r
40 X-BeenThere: notmuch@notmuchmail.org\r
41 X-Mailman-Version: 2.1.13\r
42 Precedence: list\r
43 List-Id: "Use and development of the notmuch mail system."\r
44         <notmuch.notmuchmail.org>\r
45 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
46         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
47 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
48 List-Post: <mailto:notmuch@notmuchmail.org>\r
49 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
50 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
51         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
52 X-List-Received-Date: Tue, 17 Jan 2012 19:02:53 -0000\r
53 \r
54 ---\r
55  emacs/notmuch-show.el |   46 ++++++++++++++++++++++++++++++++++++++++++++++\r
56  emacs/notmuch.el      |    8 ++++++++\r
57  2 files changed, 54 insertions(+), 0 deletions(-)\r
58 \r
59 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
60 index c1d721e..141241d 100644\r
61 --- a/emacs/notmuch-show.el\r
62 +++ b/emacs/notmuch-show.el\r
63 @@ -1506,6 +1506,52 @@ removed)."\r
64    (notmuch-show-archive-message)\r
65    (notmuch-show-next-open-message t))\r
66  \r
67 +(defun notmuch-show-delete-thread (&optional undelete)\r
68 +  "Delete each message in thread.\r
69 +\r
70 +Delete each message currently shown by adding the \"deleted\" tag\r
71 +to each.  If a prefix argument is given, the messages will be\r
72 +\"undeleted\" (ie. the \"deleted\" tag will be removed instead of\r
73 +added).\r
74 +\r
75 +Note: This command is safe from any race condition of new messages\r
76 +being delivered to the same thread. It does not archive the\r
77 +entire thread, but only the messages shown in the current\r
78 +buffer."\r
79 +  (interactive)\r
80 +  (if undelete\r
81 +      (notmuch-show-remove-tag-thread "deleted")\r
82 +    (notmuch-show-add-tag-thread "deleted")))\r
83 +\r
84 +(defun notmuch-show-delete-thread-then-next ()\r
85 +  "Delete each message in thread, then show next thread from search."\r
86 +  (interactive)\r
87 +  (notmuch-show-delete-thread)\r
88 +  (notmuch-show-next-thread t))\r
89 +\r
90 +(defun notmuch-show-delete-thread-then-exit ()\r
91 +  "Delete each message in thread, then exit back to search results."\r
92 +  (interactive)\r
93 +  (notmuch-show-delete-thread)\r
94 +  (notmuch-show-next-thread))\r
95 +\r
96 +(defun notmuch-show-delete-message (&optional undelete)\r
97 +  "Delete the current message (add \"deleted\" tag).\r
98 +\r
99 +If a prefix argument is given, the message will be\r
100 +\"undeleted\" (ie. the \"deleted\" tag will be removed instead of\r
101 +added)."\r
102 +  (interactive)\r
103 +  (if undelete\r
104 +      (notmuch-show-remove-tag "deleted")\r
105 +    (notmuch-show-add-tag "deleted")))\r
106 +\r
107 +(defun notmuch-show-delete-message-then-next ()\r
108 +  "Archive the current message, then show next thread from search."\r
109 +  (interactive)\r
110 +  (notmuch-show-delete-message)\r
111 +  (notmuch-show-next-open-message t))\r
112 +\r
113  (defun notmuch-show-stash-cc ()\r
114    "Copy CC field of current message to kill-ring."\r
115    (interactive)\r
116 diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
117 index 67ecd3a..2acb31b 100644\r
118 --- a/emacs/notmuch.el\r
119 +++ b/emacs/notmuch.el\r
120 @@ -619,6 +619,14 @@ This function advances the next thread when finished."\r
121    (notmuch-search-remove-tag-thread "inbox")\r
122    (notmuch-search-next-thread))\r
123  \r
124 +(defun notmuch-search-delete-thread ()\r
125 +  "Delete the currently selected thread (add \"deleted\" tag).\r
126 +\r
127 +This function advances the next thread when finished."\r
128 +  (interactive)\r
129 +  (notmuch-search-add-tag-thread "deleted")\r
130 +  (notmuch-search-next-thread))\r
131 +\r
132  (defvar notmuch-search-process-filter-data nil\r
133    "Data that has not yet been processed.")\r
134  (make-variable-buffer-local 'notmuch-search-process-filter-data)\r
135 -- \r
136 1.7.7.3\r
137 \r