Re: [PATCH 0/4] Allow specifying alternate names for addresses in other_email
[notmuch-archives.git] / a3 / 624aa811b8a19e35aeb1937ae7370df7f11dcd
1 Return-Path: <dme@dme.org>\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 3E4C2421193\r
6         for <notmuch@notmuchmail.org>; Tue, 17 Jan 2012 04:52:51 -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: -0.7\r
10 X-Spam-Level: \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 AnnshfuWnjYl for <notmuch@notmuchmail.org>;\r
16         Tue, 17 Jan 2012 04:52:48 -0800 (PST)\r
17 Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com\r
18         [209.85.212.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
19         (No client certificate requested)\r
20         by olra.theworths.org (Postfix) with ESMTPS id BBB77429E2F\r
21         for <notmuch@notmuchmail.org>; Tue, 17 Jan 2012 04:52:47 -0800 (PST)\r
22 Received: by wibhr12 with SMTP id hr12so3405343wib.26\r
23         for <notmuch@notmuchmail.org>; Tue, 17 Jan 2012 04:52:46 -0800 (PST)\r
24 Received: by 10.180.94.102 with SMTP id db6mr26403381wib.0.1326804766524;\r
25         Tue, 17 Jan 2012 04:52:46 -0800 (PST)\r
26 Received: from hotblack-desiato.hh.sledj.net\r
27         (host81-149-164-25.in-addr.btopenworld.com. [81.149.164.25])\r
28         by mx.google.com with ESMTPS id l8sm29244852wiy.5.2012.01.17.04.52.43\r
29         (version=TLSv1/SSLv3 cipher=OTHER);\r
30         Tue, 17 Jan 2012 04:52:44 -0800 (PST)\r
31 Received: by hotblack-desiato.hh.sledj.net (Postfix, from userid 30000)\r
32         id 08C7EA05A7; Tue, 17 Jan 2012 12:52:42 +0000 (GMT)\r
33 From: David Edmondson <dme@dme.org>\r
34 To: notmuch@notmuchmail.org\r
35 Subject:\r
36  [PATCH 4/4] emacs: Another special case for `notmuch-show-clean-address'.\r
37 Date: Tue, 17 Jan 2012 12:52:28 +0000\r
38 Message-Id: <1326804748-8989-5-git-send-email-dme@dme.org>\r
39 X-Mailer: git-send-email 1.7.7.3\r
40 In-Reply-To: <1326804748-8989-1-git-send-email-dme@dme.org>\r
41 References: <1326804748-8989-1-git-send-email-dme@dme.org>\r
42 MIME-Version: 1.0\r
43 Content-Type: text/plain; charset=UTF-8\r
44 Content-Transfer-Encoding: 8bit\r
45 X-BeenThere: notmuch@notmuchmail.org\r
46 X-Mailman-Version: 2.1.13\r
47 Precedence: list\r
48 List-Id: "Use and development of the notmuch mail system."\r
49         <notmuch.notmuchmail.org>\r
50 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
51         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
52 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
53 List-Post: <mailto:notmuch@notmuchmail.org>\r
54 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
55 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
56         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
57 X-List-Received-Date: Tue, 17 Jan 2012 12:52:51 -0000\r
58 \r
59 Remove backslashes.\r
60 ---\r
61  emacs/notmuch-show.el    |   14 +++++++++-----\r
62  test/address-cleaning.el |    6 ++++--\r
63  2 files changed, 13 insertions(+), 7 deletions(-)\r
64 \r
65 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
66 index 8b2fbb3..90c9c05 100644\r
67 --- a/emacs/notmuch-show.el\r
68 +++ b/emacs/notmuch-show.el\r
69 @@ -248,11 +248,15 @@ unchanged ADDRESS if parsing fails."\r
70         (t\r
71         (setq p-address address)))\r
72        \r
73 -      ;; Remove outer double quotes. They might be required during\r
74 -      ;; transport, but we don't need to see them.\r
75 -      (when (and p-name\r
76 -                (string-match "^\"\\(.*\\)\"$" p-name))\r
77 -        (setq p-name (match-string 1 p-name)))\r
78 +      ;; Remove elements of the mailbox part that are not relevant for\r
79 +      ;; display, even if they are required during transport.\r
80 +      (when p-name\r
81 +       ;; Outer double quotes.\r
82 +       (when (string-match "^\"\\(.*\\)\"$" p-name)\r
83 +         (setq p-name (match-string 1 p-name)))\r
84 +\r
85 +       ;; Backslashes.\r
86 +       (setq p-name (replace-regexp-in-string "\\\\" "" p-name)))\r
87  \r
88        ;; If the address is 'foo@bar.com <foo@bar.com>' then show just\r
89        ;; 'foo@bar.com'.\r
90 diff --git a/test/address-cleaning.el b/test/address-cleaning.el\r
91 index 59e8d92..83d6263 100644\r
92 --- a/test/address-cleaning.el\r
93 +++ b/test/address-cleaning.el\r
94 @@ -20,10 +20,12 @@\r
95    (let* ((input '("ДБ <db-uknot@stop.me.uk>"\r
96                   "foo (at home) <foo@bar.com>"\r
97                   "foo [at home] <foo@bar.com>"\r
98 -                 "Foo Bar"))\r
99 +                 "Foo Bar"\r
100 +                 "Fred Dibna \\[extraordinaire\\] <fred@dibna.com>"))\r
101          (expected '("ДБ <db-uknot@stop.me.uk>"\r
102                      "foo (at home) <foo@bar.com>"\r
103                      "foo [at home] <foo@bar.com>"\r
104 -                    "Foo Bar"))\r
105 +                    "Foo Bar"\r
106 +                    "Fred Dibna [extraordinaire] <fred@dibna.com>"))\r
107          (output (mapcar #'notmuch-show-clean-address input)))\r
108      (notmuch-test-compare output expected)))\r
109 -- \r
110 1.7.7.3\r
111 \r