[PATCH 4/4] emacs: Another special case for `notmuch-show-clean-address'.
authorDavid Edmondson <dme@dme.org>
Tue, 17 Jan 2012 12:52:28 +0000 (12:52 +0000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:42:25 +0000 (09:42 -0800)
a3/624aa811b8a19e35aeb1937ae7370df7f11dcd [new file with mode: 0644]

diff --git a/a3/624aa811b8a19e35aeb1937ae7370df7f11dcd b/a3/624aa811b8a19e35aeb1937ae7370df7f11dcd
new file mode 100644 (file)
index 0000000..86ce74b
--- /dev/null
@@ -0,0 +1,111 @@
+Return-Path: <dme@dme.org>\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 3E4C2421193\r
+       for <notmuch@notmuchmail.org>; Tue, 17 Jan 2012 04:52:51 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 AnnshfuWnjYl for <notmuch@notmuchmail.org>;\r
+       Tue, 17 Jan 2012 04:52:48 -0800 (PST)\r
+Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com\r
+       [209.85.212.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id BBB77429E2F\r
+       for <notmuch@notmuchmail.org>; Tue, 17 Jan 2012 04:52:47 -0800 (PST)\r
+Received: by wibhr12 with SMTP id hr12so3405343wib.26\r
+       for <notmuch@notmuchmail.org>; Tue, 17 Jan 2012 04:52:46 -0800 (PST)\r
+Received: by 10.180.94.102 with SMTP id db6mr26403381wib.0.1326804766524;\r
+       Tue, 17 Jan 2012 04:52:46 -0800 (PST)\r
+Received: from hotblack-desiato.hh.sledj.net\r
+       (host81-149-164-25.in-addr.btopenworld.com. [81.149.164.25])\r
+       by mx.google.com with ESMTPS id l8sm29244852wiy.5.2012.01.17.04.52.43\r
+       (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Tue, 17 Jan 2012 04:52:44 -0800 (PST)\r
+Received: by hotblack-desiato.hh.sledj.net (Postfix, from userid 30000)\r
+       id 08C7EA05A7; Tue, 17 Jan 2012 12:52:42 +0000 (GMT)\r
+From: David Edmondson <dme@dme.org>\r
+To: notmuch@notmuchmail.org\r
+Subject:\r
+ [PATCH 4/4] emacs: Another special case for `notmuch-show-clean-address'.\r
+Date: Tue, 17 Jan 2012 12:52:28 +0000\r
+Message-Id: <1326804748-8989-5-git-send-email-dme@dme.org>\r
+X-Mailer: git-send-email 1.7.7.3\r
+In-Reply-To: <1326804748-8989-1-git-send-email-dme@dme.org>\r
+References: <1326804748-8989-1-git-send-email-dme@dme.org>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=UTF-8\r
+Content-Transfer-Encoding: 8bit\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: Tue, 17 Jan 2012 12:52:51 -0000\r
+\r
+Remove backslashes.\r
+---\r
+ emacs/notmuch-show.el    |   14 +++++++++-----\r
+ test/address-cleaning.el |    6 ++++--\r
+ 2 files changed, 13 insertions(+), 7 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+index 8b2fbb3..90c9c05 100644\r
+--- a/emacs/notmuch-show.el\r
++++ b/emacs/notmuch-show.el\r
+@@ -248,11 +248,15 @@ unchanged ADDRESS if parsing fails."\r
+        (t\r
+       (setq p-address address)))\r
+       \r
+-      ;; Remove outer double quotes. They might be required during\r
+-      ;; transport, but we don't need to see them.\r
+-      (when (and p-name\r
+-               (string-match "^\"\\(.*\\)\"$" p-name))\r
+-        (setq p-name (match-string 1 p-name)))\r
++      ;; Remove elements of the mailbox part that are not relevant for\r
++      ;; display, even if they are required during transport.\r
++      (when p-name\r
++      ;; Outer double quotes.\r
++      (when (string-match "^\"\\(.*\\)\"$" p-name)\r
++        (setq p-name (match-string 1 p-name)))\r
++\r
++      ;; Backslashes.\r
++      (setq p-name (replace-regexp-in-string "\\\\" "" p-name)))\r
\r
+       ;; If the address is 'foo@bar.com <foo@bar.com>' then show just\r
+       ;; 'foo@bar.com'.\r
+diff --git a/test/address-cleaning.el b/test/address-cleaning.el\r
+index 59e8d92..83d6263 100644\r
+--- a/test/address-cleaning.el\r
++++ b/test/address-cleaning.el\r
+@@ -20,10 +20,12 @@\r
+   (let* ((input '("ДБ <db-uknot@stop.me.uk>"\r
+                 "foo (at home) <foo@bar.com>"\r
+                 "foo [at home] <foo@bar.com>"\r
+-                "Foo Bar"))\r
++                "Foo Bar"\r
++                "Fred Dibna \\[extraordinaire\\] <fred@dibna.com>"))\r
+        (expected '("ДБ <db-uknot@stop.me.uk>"\r
+                    "foo (at home) <foo@bar.com>"\r
+                    "foo [at home] <foo@bar.com>"\r
+-                   "Foo Bar"))\r
++                   "Foo Bar"\r
++                   "Fred Dibna [extraordinaire] <fred@dibna.com>"))\r
+        (output (mapcar #'notmuch-show-clean-address input)))\r
+     (notmuch-test-compare output expected)))\r
+-- \r
+1.7.7.3\r
+\r