Re: [PATCH 0/4] Allow specifying alternate names for addresses in other_email
[notmuch-archives.git] / 4f / d4a854892db47429958250822a20b8598caa3e
1 Return-Path: <racin@free.fr>\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 C8925431FBD\r
6         for <notmuch@notmuchmail.org>; Sat, 27 Feb 2010 02:34:45 -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: -1.691\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-1.691 tagged_above=-999 required=5 tests=[AWL=0.908,\r
12         BAYES_00=-2.599] autolearn=unavailable\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 mPnM5VeXFQt1 for <notmuch@notmuchmail.org>;\r
16         Sat, 27 Feb 2010 02:34:43 -0800 (PST)\r
17 Received: from smtp5-g21.free.fr (smtp5-g21.free.fr [212.27.42.5])\r
18         by olra.theworths.org (Postfix) with ESMTP id 12C76431FAE\r
19         for <notmuch@notmuchmail.org>; Sat, 27 Feb 2010 02:34:41 -0800 (PST)\r
20 Received: from smtp5-g21.free.fr (localhost [127.0.0.1])\r
21         by smtp5-g21.free.fr (Postfix) with ESMTP id 4614DD4812B;\r
22         Sat, 27 Feb 2010 11:34:29 +0100 (CET)\r
23 Received: from zimbra1-e1.priv.proxad.net (zimbra1-e1.priv.proxad.net\r
24         [172.20.243.151])\r
25         by smtp5-g21.free.fr (Postfix) with ESMTP id 4376FD480C8;\r
26         Sat, 27 Feb 2010 11:34:27 +0100 (CET)\r
27 Date: Sat, 27 Feb 2010 11:34:27 +0100 (CET)\r
28 From: racin@free.fr\r
29 To: Carl Worth <cworth@cworth.org>\r
30 Message-ID:\r
31  <1673492941.5760781267266866949.JavaMail.root@zimbra1-e1.priv.proxad.net>\r
32 In-Reply-To:\r
33  <1427711643.5760731267266834921.JavaMail.root@zimbra1-e1.priv.proxad.net>\r
34 MIME-Version: 1.0\r
35 Content-Type: multipart/mixed; \r
36         boundary="----=_Part_211406_2111002656.1267266866945"\r
37 X-Originating-IP: [82.239.207.166]\r
38 X-Mailer: Zimbra 5.0 (ZimbraWebClient - FF3.0\r
39         (Linux)/5.0.15_GA_2815.UBUNTU8_64)\r
40 X-Authenticated-User: racin@free.fr\r
41 Cc: notmuch@notmuchmail.org\r
42 Subject: Re: [notmuch] [PATCH] Support for deletion (patch included)\r
43 X-BeenThere: notmuch@notmuchmail.org\r
44 X-Mailman-Version: 2.1.13\r
45 Precedence: list\r
46 List-Id: "Use and development of the notmuch mail system."\r
47         <notmuch.notmuchmail.org>\r
48 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
49         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
50 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
51 List-Post: <mailto:notmuch@notmuchmail.org>\r
52 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
53 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
54         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
55 X-List-Received-Date: Sat, 27 Feb 2010 10:34:45 -0000\r
56 \r
57 ------=_Part_211406_2111002656.1267266866945\r
58 Content-Type: text/plain; charset=utf-8\r
59 Content-Transfer-Encoding: quoted-printable\r
60 \r
61 Here they are; as I don't know how to include them in the body, I put the p=\r
62 atches as attachments. I hope this=20\r
63 will be convienient enough for you.\r
64 \r
65 \r
66 Matthieu\r
67 \r
68 ----- racin@free.fr a =C3=A9crit :\r
69 \r
70 > Carl: The patch in the mail has problems; apparently I have to\r
71 > manually add scissorlines to the mail for it\r
72 > to be processed by git-am. I thought this was automatically added. (I\r
73 > hate the git UI -- nothing is consistent,\r
74 > concepts have different names, the definition of scissor lines is as\r
75 > precise as "A line that mainly consists of scissors (either ">8" or\r
76 > "8<") and perforation (dash "-") --, but I guess we can get used to it\r
77 > after a while...)\r
78 >=20\r
79 > I'll send you a proper patch as soon as I can. Meanwhile, I'm sure you\r
80 > have comments on this updated patch!\r
81 >=20\r
82 > Matthieu\r
83 >\r
84 ------=_Part_211406_2111002656.1267266866945\r
85 Content-Type: text/x-diff;\r
86         name=0002-Add-support-for-deletion-in-the-emacs-interface.patch\r
87 Content-Transfer-Encoding: 7bit\r
88 Content-Disposition: attachment;\r
89         filename=0002-Add-support-for-deletion-in-the-emacs-interface.patch\r
90 \r
91 >From 0073152e3fa7dd11d88de28e87eec7762cdbbbeb Mon Sep 17 00:00:00 2001\r
92 From: Matthieu Lemerre <racin@free.fr>\r
93 Date: Thu, 25 Feb 2010 00:25:51 +0100\r
94 Subject: [PATCH 2/2] Add support for deletion in the emacs interface\r
95 \r
96 Add "d" keybinding in notmuch-show and notmuch-summary to delete the current\r
97 thread. Adds "D" keybinding to delete the current message in notmuch-show.\r
98 Adds a "deleted" folder. Omit deleted items from searchs if no prefix arg.\r
99 Adds history management to make searching deleted items more convenient.\r
100 \r
101 ---\r
102  notmuch.el |   56 +++++++++++++++++++++++++++++++++++++++++++++++++-------\r
103  1 files changed, 49 insertions(+), 7 deletions(-)\r
104 \r
105 diff --git a/notmuch.el b/notmuch.el\r
106 index 5d7342a..0285573 100644\r
107 --- a/notmuch.el\r
108 +++ b/notmuch.el\r
109 @@ -92,6 +92,8 @@\r
110      (define-key map "x" 'notmuch-show-archive-thread-then-exit)\r
111      (define-key map "A" 'notmuch-show-mark-read-then-archive-thread)\r
112      (define-key map "a" 'notmuch-show-archive-thread)\r
113 +    (define-key map "d" 'notmuch-show-delete-thread)\r
114 +    (define-key map "D" 'notmuch-show-delete-message)\r
115      (define-key map "p" 'notmuch-show-previous-message)\r
116      (define-key map "N" 'notmuch-show-mark-read-then-next-open-message)\r
117      (define-key map "n" 'notmuch-show-next-message)\r
118 @@ -380,6 +382,23 @@ buffer."\r
119    (notmuch-show-archive-thread)\r
120    (kill-this-buffer))\r
121  \r
122 +(defun notmuch-show-delete-message ()\r
123 +  "Delete current message (sets its deleted tag)."\r
124 +  (interactive)\r
125 +  (notmuch-show-add-tag "deleted"))\r
126 +\r
127 +(defun notmuch-show-delete-thread()\r
128 +  "Delete each message in thread."\r
129 +  (interactive)\r
130 +  (notmuch-show-forall-in-thread\r
131 +   (notmuch-show-delete-message)))\r
132 +\r
133 +(defun notmuch-show-delete-thread-and-exit()\r
134 +  "Delete each message in thread, then exit back to search results."\r
135 +  (interactive)\r
136 +  (notmuch-show-delete-thread)\r
137 +  (kill-this-buffer))\r
138 +\r
139  (defun notmuch-show-mark-read-then-archive-then-exit ()\r
140    "Remove unread tags from thread, then archive and exit to search results."\r
141    (interactive)\r
142 @@ -1227,6 +1246,7 @@ matching this search term are shown if non-nil. "\r
143      (define-key map [mouse-1] 'notmuch-search-show-thread)\r
144      (define-key map "*" 'notmuch-search-operate-all)\r
145      (define-key map "a" 'notmuch-search-archive-thread)\r
146 +    (define-key map "d" 'notmuch-search-delete-thread)\r
147      (define-key map "-" 'notmuch-search-remove-tag)\r
148      (define-key map "+" 'notmuch-search-add-tag)\r
149      (define-key map (kbd "RET") 'notmuch-search-show-thread)\r
150 @@ -1235,6 +1255,7 @@ matching this search term are shown if non-nil. "\r
151  (fset 'notmuch-search-mode-map notmuch-search-mode-map)\r
152  \r
153  (defvar notmuch-search-query-string)\r
154 +(defvar notmuch-search-history nil)\r
155  (defvar notmuch-search-oldest-first t\r
156    "Show the oldest mail first in the search-mode")\r
157  \r
158 @@ -1446,6 +1467,13 @@ This function advances the next thread when finished."\r
159    (notmuch-search-remove-tag "inbox")\r
160    (forward-line))\r
161  \r
162 +(defun notmuch-search-delete-thread ()\r
163 +  "Mark the currently selected thread as deleted (set its \"deleted\" tag).\r
164 +This function advances the next thread when finished."\r
165 +  (interactive)\r
166 +  (notmuch-search-add-tag "deleted")\r
167 +  (forward-line))\r
168 +\r
169  (defun notmuch-search-process-sentinel (proc msg)\r
170    "Add a message to let user know when \"notmuch search\" exits"\r
171    (let ((buffer (process-buffer proc))\r
172 @@ -1520,10 +1548,22 @@ characters as well as `_.+-'.\r
173            (append action-split (list notmuch-search-query-string) nil))))\r
174  \r
175  ;;;###autoload\r
176 -(defun notmuch-search (query &optional oldest-first)\r
177 -  "Run \"notmuch search\" with the given query string and display results."\r
178 -  (interactive "sNotmuch search: ")\r
179 -  (let ((buffer (get-buffer-create (concat "*notmuch-search-" query "*"))))\r
180 +(defun notmuch-search (query &optional oldest-first include-deleted)\r
181 +  "Run \"notmuch search\" with the given query string and display results.\r
182 +\r
183 +With prefix argument, include deleted items.\r
184 +"\r
185 +  (interactive (let* ((prefix current-prefix-arg)\r
186 +                     (query (if prefix\r
187 +                                (read-string "Notmuch search (including deleted): "\r
188 +                                             notmuch-search-query-string\r
189 +                                             'notmuch-search-history)\r
190 +                              (read-string "Notmuch search: " nil\r
191 +                                           'notmuch-search-history))))\r
192 +                (list query nil prefix)))\r
193 +  (let ((real-query (if include-deleted query \r
194 +                     (concat "not tag:deleted and (" query ")")))\r
195 +       (buffer (get-buffer-create (concat "*notmuch-search-" query "*"))))\r
196      (switch-to-buffer buffer)\r
197      (notmuch-search-mode)\r
198      (set 'notmuch-search-query-string query)\r
199 @@ -1539,7 +1579,7 @@ characters as well as `_.+-'.\r
200         (let ((proc (start-process-shell-command\r
201                      "notmuch-search" buffer notmuch-command "search"\r
202                      (if oldest-first "--sort=oldest-first" "--sort=newest-first")\r
203 -                    (shell-quote-argument query))))\r
204 +                    (shell-quote-argument real-query))))\r
205           (set-process-sentinel proc 'notmuch-search-process-sentinel)\r
206           (set-process-filter proc 'notmuch-search-process-filter))))\r
207      (run-hooks 'notmuch-search-hook)))\r
208 @@ -1587,7 +1627,7 @@ search."\r
209  \r
210  Runs a new search matching only messages that match both the\r
211  current search results AND the additional query string provided."\r
212 -  (interactive "sFilter search: ")\r
213 +  (interactive "sFilter search:")\r
214    (let ((grouped-query (if (string-match-p notmuch-search-disjunctive-regexp query) (concat "( " query " )") query)))\r
215      (notmuch-search (concat notmuch-search-query-string " and " grouped-query) notmuch-search-oldest-first)))\r
216  \r
217 @@ -1630,7 +1670,9 @@ current search results AND that are tagged with the given tag."\r
218  \r
219  (fset 'notmuch-folder-mode-map notmuch-folder-mode-map)\r
220  \r
221 -(defcustom notmuch-folders (quote (("inbox" . "tag:inbox") ("unread" . "tag:unread")))\r
222 +(defcustom notmuch-folders (quote (("inbox" . "tag:inbox") \r
223 +                                  ("unread" . "tag:unread")\r
224 +                                  ("deleted" . "tag:deleted")))\r
225    "List of searches for the notmuch folder view"\r
226    :type '(alist :key-type (string) :value-type (string))\r
227    :group 'notmuch)\r
228 -- \r
229 1.6.5\r
230 \r
231 \r
232 ------=_Part_211406_2111002656.1267266866945\r
233 Content-Type: text/x-diff;\r
234         name=0001-Add-and-use-notmuch-show-forall-in-thread-macro.patch\r
235 Content-Transfer-Encoding: 7bit\r
236 Content-Disposition: attachment;\r
237         filename=0001-Add-and-use-notmuch-show-forall-in-thread-macro.patch\r
238 \r
239 >From bdee9558d93bffb97c80632f522288e059deb7c2 Mon Sep 17 00:00:00 2001\r
240 From: Matthieu Lemerre <racin@free.fr>\r
241 Date: Thu, 25 Feb 2010 00:24:24 +0100\r
242 Subject: [PATCH 1/2] Add and use notmuch-show-forall-in-thread macro\r
243 \r
244 This macro allows to apply a message-related command to every message\r
245 in a thread.\r
246 \r
247 ---\r
248  notmuch.el |   17 +++++++++++------\r
249  1 files changed, 11 insertions(+), 6 deletions(-)\r
250 \r
251 diff --git a/notmuch.el b/notmuch.el\r
252 index 6482170..5d7342a 100644\r
253 --- a/notmuch.el\r
254 +++ b/notmuch.el\r
255 @@ -321,17 +321,22 @@ pseudoheader summary"\r
256                          (cons (notmuch-show-get-message-id) nil)))\r
257           (notmuch-show-set-tags (sort (set-difference tags toremove :test 'string=) 'string<))))))\r
258  \r
259 -(defun notmuch-show-archive-thread-maybe-mark-read (markread)\r
260 -  (save-excursion\r
261 +(defmacro notmuch-show-forall-in-thread (&rest body)\r
262 +  "Executes BODY with point in all messages of the current thread."\r
263 +  `(save-excursion\r
264      (goto-char (point-min))\r
265      (while (not (eobp))\r
266 -      (if markread\r
267 -         (notmuch-show-remove-tag "unread" "inbox")\r
268 -       (notmuch-show-remove-tag "inbox"))\r
269 +      ,@body\r
270        (if (not (eobp))\r
271           (forward-char))\r
272        (if (not (re-search-forward notmuch-show-message-begin-regexp nil t))\r
273 -         (goto-char (point-max)))))\r
274 +         (goto-char (point-max))))))\r
275 +\r
276 +(defun notmuch-show-archive-thread-maybe-mark-read (markread)\r
277 +  (notmuch-show-forall-in-thread\r
278 +      (if markread\r
279 +         (notmuch-show-remove-tag "unread" "inbox")\r
280 +       (notmuch-show-remove-tag "inbox")))\r
281    (let ((parent-buffer notmuch-show-parent-buffer))\r
282      (kill-this-buffer)\r
283      (if parent-buffer\r
284 -- \r
285 1.6.5\r
286 \r
287 \r
288 ------=_Part_211406_2111002656.1267266866945--\r