1 Return-Path: <amdragon@mit.edu>
\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 E4E26431E64
\r
6 for <notmuch@notmuchmail.org>; Mon, 30 Jan 2012 07:05:46 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5
\r
12 tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 sjq9MZYKi1Zo for <notmuch@notmuchmail.org>;
\r
16 Mon, 30 Jan 2012 07:05:46 -0800 (PST)
\r
17 Received: from dmz-mailsec-scanner-6.mit.edu (DMZ-MAILSEC-SCANNER-6.MIT.EDU
\r
19 by olra.theworths.org (Postfix) with ESMTP id 47A61431FBC
\r
20 for <notmuch@notmuchmail.org>; Mon, 30 Jan 2012 07:05:46 -0800 (PST)
\r
21 X-AuditID: 12074423-b7f9c6d0000008c3-f3-4f26b1c9327e
\r
22 Received: from mailhub-auth-3.mit.edu ( [18.9.21.43])
\r
23 by dmz-mailsec-scanner-6.mit.edu (Symantec Messaging Gateway) with SMTP
\r
24 id 30.DC.02243.9C1B62F4; Mon, 30 Jan 2012 10:05:45 -0500 (EST)
\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])
\r
26 by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id q0UF5iNv005314;
\r
27 Mon, 30 Jan 2012 10:05:45 -0500
\r
28 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])
\r
29 (authenticated bits=0)
\r
30 (User authenticated as amdragon@ATHENA.MIT.EDU)
\r
31 by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q0UF5he8021054
\r
32 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);
\r
33 Mon, 30 Jan 2012 10:05:44 -0500 (EST)
\r
34 Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77)
\r
35 (envelope-from <amdragon@mit.edu>)
\r
36 id 1Rrsmr-0001tJ-Je; Mon, 30 Jan 2012 10:04:53 -0500
\r
37 Date: Mon, 30 Jan 2012 10:04:53 -0500
\r
38 From: Austin Clements <amdragon@MIT.EDU>
\r
39 To: David Edmondson <dme@dme.org>
\r
40 Subject: Re: [PATCH] emacs: More address cleaning.
\r
41 Message-ID: <20120130150453.GQ17991@mit.edu>
\r
42 References: <1327935594-14180-1-git-send-email-dme@dme.org>
\r
44 Content-Type: text/plain; charset=utf-8
\r
45 Content-Disposition: inline
\r
46 Content-Transfer-Encoding: 8bit
\r
47 In-Reply-To: <1327935594-14180-1-git-send-email-dme@dme.org>
\r
48 User-Agent: Mutt/1.5.21 (2010-09-15)
\r
49 X-Brightmail-Tracker:
\r
50 H4sIAAAAAAAAA+NgFprBKsWRmVeSWpSXmKPExsUixCmqrXtyo5q/wdTFJhb77mxhsrh+cyaz
\r
51 A5PHrud/mTyerbrFHMAUxWWTkpqTWZZapG+XwJVx4s9C5oJdohUPlwc0MB4R6GLk5JAQMJF4
\r
52 Mek/O4QtJnHh3no2EFtIYB+jxMuLXBD2BkaJvssuXYxcQPZJJokXfzeyQThLGCVuTb7KDFLF
\r
53 IqAq8fP0RBYQm01AQ2Lb/uWMILaIgKLE/28rwDYwC0hLfPvdzARiCwsYSfy9dx+ohoODV0BH
\r
54 4v9xCYhl1hKn13SClfMKCEqcnPmEBaJVXeLPvEvMIOUgY5b/44AIy0s0b50NdgGngI3Evt9v
\r
55 wbaKCqhITDm5jW0Co/AsJJNmIZk0C2HSLCSTFjCyrGKUTcmt0s1NzMwpTk3WLU5OzMtLLdI1
\r
56 08vNLNFLTSndxAiKAHYX5R2Mfw4qHWIU4GBU4uEN+qfqL8SaWFZcmXuIUZKDSUmUNxoYP0J8
\r
57 SfkplRmJxRnxRaU5qcWHGCU4mJVEeN+sBsrxpiRWVqUW5cOkpDlYlMR5NbTe+QkJpCeWpGan
\r
58 phakFsFkZTg4lCR4dUGGChalpqdWpGXmlCCkmTg4QYbzAA1XA6nhLS5IzC3OTIfIn2JUlBLn
\r
59 5QJJCIAkMkrz4HphCeoVozjQK8K8qiBVPMDkBtf9CmgwE9Dg5wyqIINLEhFSUg2MHXKPb03K
\r
60 m6n4w7Mr2Kpafl07/x87jrn36yRv/FW7Or9mvqJ2rHrSw7D0rtdVCu6tT84+f886wXa9lck+
\r
61 vhfCPSY7p87+2tIX8IbNeNf5j8Hp747wMhfah8uuE5f1Kj7a4fek/nn26bKNZVdYL0xzvBq7
\r
62 7+KrBSeE9Vw3p1/U1O7Xf6sjsu6VEktxRqKhFnNRcSIAI4R0tisDAAA=
\r
63 Cc: notmuch@notmuchmail.org
\r
64 X-BeenThere: notmuch@notmuchmail.org
\r
65 X-Mailman-Version: 2.1.13
\r
67 List-Id: "Use and development of the notmuch mail system."
\r
68 <notmuch.notmuchmail.org>
\r
69 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
70 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
71 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
72 List-Post: <mailto:notmuch@notmuchmail.org>
\r
73 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
74 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
75 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
76 X-List-Received-Date: Mon, 30 Jan 2012 15:05:47 -0000
\r
78 loop freaks me out a little, but LGTM.
\r
80 Quoth David Edmondson on Jan 30 at 2:59 pm:
\r
81 > Remove outer single-quotes from the mailbox part. Allow for multiple
\r
82 > sets of nested single and double quotes.
\r
86 > emacs/notmuch-show.el | 24 +++++++++++++++++-------
\r
87 > test/emacs-address-cleaning.el | 8 ++++++++
\r
88 > 2 files changed, 25 insertions(+), 7 deletions(-)
\r
90 > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
\r
91 > index 84ac624..7bfbda9 100644
\r
92 > --- a/emacs/notmuch-show.el
\r
93 > +++ b/emacs/notmuch-show.el
\r
94 > @@ -315,15 +315,25 @@ unchanged ADDRESS if parsing fails."
\r
96 > (setq p-address address)))
\r
98 > - ;; Remove elements of the mailbox part that are not relevant for
\r
99 > - ;; display, even if they are required during transport.
\r
101 > - ;; Outer double quotes.
\r
102 > - (when (string-match "^\"\\(.*\\)\"$" p-name)
\r
103 > - (setq p-name (match-string 1 p-name)))
\r
105 > + ;; Remove elements of the mailbox part that are not relevant for
\r
106 > + ;; display, even if they are required during transport:
\r
109 > - (setq p-name (replace-regexp-in-string "\\\\" "" p-name)))
\r
110 > + (setq p-name (replace-regexp-in-string "\\\\" "" p-name))
\r
112 > + ;; Outer single and double quotes, which might be nested.
\r
114 > + with start-of-loop
\r
115 > + do (setq start-of-loop p-name)
\r
117 > + when (string-match "^\"\\(.*\\)\"$" p-name)
\r
118 > + do (setq p-name (match-string 1 p-name))
\r
120 > + when (string-match "^'\\(.*\\)'$" p-name)
\r
121 > + do (setq p-name (match-string 1 p-name))
\r
123 > + until (string= start-of-loop p-name)))
\r
125 > ;; If the address is 'foo@bar.com <foo@bar.com>' then show just
\r
126 > ;; 'foo@bar.com'.
\r
127 > diff --git a/test/emacs-address-cleaning.el b/test/emacs-address-cleaning.el
\r
128 > index 3b0b109..8423245 100644
\r
129 > --- a/test/emacs-address-cleaning.el
\r
130 > +++ b/test/emacs-address-cleaning.el
\r
131 > @@ -21,11 +21,19 @@
\r
132 > "foo (at home) <foo@bar.com>"
\r
133 > "foo [at home] <foo@bar.com>"
\r
135 > + "'Foo Bar' <foo@bar.com>"
\r
136 > + "\"'Foo Bar'\" <foo@bar.com>"
\r
137 > + "'\"Foo Bar\"' <foo@bar.com>"
\r
138 > + "'\"'Foo Bar'\"' <foo@bar.com>"
\r
139 > "Fred Dibna \\[extraordinaire\\] <fred@dibna.com>"))
\r
140 > (expected '("ДБ <db-uknot@stop.me.uk>"
\r
141 > "foo (at home) <foo@bar.com>"
\r
142 > "foo [at home] <foo@bar.com>"
\r
144 > + "Foo Bar <foo@bar.com>"
\r
145 > + "Foo Bar <foo@bar.com>"
\r
146 > + "Foo Bar <foo@bar.com>"
\r
147 > + "Foo Bar <foo@bar.com>"
\r
148 > "Fred Dibna [extraordinaire] <fred@dibna.com>"))
\r
149 > (output (mapcar #'notmuch-show-clean-address input)))
\r
150 > (notmuch-test-expect-equal output expected)))
\r