Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 996E5431FD5 for ; Wed, 25 Jan 2012 05:54:07 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.7 X-Spam-Level: X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id H2uTLPGYF7ub for ; Wed, 25 Jan 2012 05:54:07 -0800 (PST) Received: from mail-ww0-f45.google.com (mail-ww0-f45.google.com [74.125.82.45]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id C168E431FBC for ; Wed, 25 Jan 2012 05:54:06 -0800 (PST) Received: by wgbdt12 with SMTP id dt12so4815007wgb.2 for ; Wed, 25 Jan 2012 05:54:05 -0800 (PST) Received: by 10.181.13.113 with SMTP id ex17mr17501561wid.15.1327499645523; Wed, 25 Jan 2012 05:54:05 -0800 (PST) Received: from hotblack-desiato.hh.sledj.net (host81-149-164-25.in-addr.btopenworld.com. [81.149.164.25]) by mx.google.com with ESMTPS id fr8sm1666145wib.10.2012.01.25.05.54.03 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 25 Jan 2012 05:54:04 -0800 (PST) Received: by hotblack-desiato.hh.sledj.net (Postfix, from userid 30000) id 047B69FF26; Wed, 25 Jan 2012 13:54:02 +0000 (GMT) From: David Edmondson To: notmuch@notmuchmail.org Subject: [PATCH 3/3] emacs: Another special case for `notmuch-show-clean-address'. Date: Wed, 25 Jan 2012 13:54:00 +0000 Message-Id: <1327499640-11747-4-git-send-email-dme@dme.org> X-Mailer: git-send-email 1.7.8.3 In-Reply-To: <1327499640-11747-1-git-send-email-dme@dme.org> References: <1327491904-28416-1-git-send-email-dme@dme.org> <1327499640-11747-1-git-send-email-dme@dme.org> MIME-Version: 1.0 X-Gm-Message-State: ALoCoQnK6bq33Rm//ifb145qvhHSLv2wmmT0+xZqwTJm7gty9uZhtv34GYbHCVZ1E4QOIExXLyu8 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Jan 2012 13:54:07 -0000 Remove backslashes. --- emacs/notmuch-show.el | 14 +++++++++----- test/emacs-address-cleaning.el | 6 ++++-- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index 1fd2524..c849e84 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -310,11 +310,15 @@ unchanged ADDRESS if parsing fails." (t (setq p-address address))) - ;; Remove outer double quotes. They might be required during - ;; transport, but we don't need to see them. - (when (and p-name - (string-match "^\"\\(.*\\)\"$" p-name)) - (setq p-name (match-string 1 p-name))) + ;; Remove elements of the mailbox part that are not relevant for + ;; display, even if they are required during transport. + (when p-name + ;; Outer double quotes. + (when (string-match "^\"\\(.*\\)\"$" p-name) + (setq p-name (match-string 1 p-name))) + + ;; Backslashes. + (setq p-name (replace-regexp-in-string "\\\\" "" p-name))) ;; If the address is 'foo@bar.com ' then show just ;; 'foo@bar.com'. diff --git a/test/emacs-address-cleaning.el b/test/emacs-address-cleaning.el index 19e9e05..3b0b109 100644 --- a/test/emacs-address-cleaning.el +++ b/test/emacs-address-cleaning.el @@ -20,10 +20,12 @@ (let* ((input '("ДБ " "foo (at home) " "foo [at home] " - "Foo Bar")) + "Foo Bar" + "Fred Dibna \\[extraordinaire\\] ")) (expected '("ДБ " "foo (at home) " "foo [at home] " - "Foo Bar")) + "Foo Bar" + "Fred Dibna [extraordinaire] ")) (output (mapcar #'notmuch-show-clean-address input))) (notmuch-test-expect-equal output expected))) -- 1.7.8.3