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 960A240D158
\r
6 for <notmuch@notmuchmail.org>; Fri, 5 Nov 2010 08:05:06 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5
\r
12 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001] autolearn=ham
\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 O4Z3nNfR-d-5 for <notmuch@notmuchmail.org>;
\r
16 Fri, 5 Nov 2010 08:04:56 -0700 (PDT)
\r
17 Received: from mail-ey0-f181.google.com (mail-ey0-f181.google.com
\r
19 by olra.theworths.org (Postfix) with ESMTP id CF42C4196F2
\r
20 for <notmuch@notmuchmail.org>; Fri, 5 Nov 2010 08:04:55 -0700 (PDT)
\r
21 Received: by eyb6 with SMTP id 6so1860320eyb.26
\r
22 for <notmuch@notmuchmail.org>; Fri, 05 Nov 2010 08:04:52 -0700 (PDT)
\r
23 Received: by 10.216.23.206 with SMTP id v56mr1282963wev.67.1288969491950;
\r
24 Fri, 05 Nov 2010 08:04:51 -0700 (PDT)
\r
25 Received: from ut.hh.sledj.net (host81-149-164-25.in-addr.btopenworld.com
\r
27 by mx.google.com with ESMTPS id x23sm894024weq.34.2010.11.05.08.04.50
\r
28 (version=TLSv1/SSLv3 cipher=RC4-MD5);
\r
29 Fri, 05 Nov 2010 08:04:51 -0700 (PDT)
\r
30 Received: by ut.hh.sledj.net (Postfix, from userid 1000)
\r
31 id 1CD3F59405B; Fri, 5 Nov 2010 15:04:18 +0000 (GMT)
\r
32 From: David Edmondson <dme@dme.org>
\r
33 To: notmuch@notmuchmail.org
\r
34 Subject: [PATCH] emacs: Show cleaner addresses during message display.
\r
35 Date: Fri, 5 Nov 2010 15:04:16 +0000
\r
36 Message-Id: <1288969456-15997-1-git-send-email-dme@dme.org>
\r
37 X-Mailer: git-send-email 1.7.2.3
\r
38 X-BeenThere: notmuch@notmuchmail.org
\r
39 X-Mailman-Version: 2.1.13
\r
41 List-Id: "Use and development of the notmuch mail system."
\r
42 <notmuch.notmuchmail.org>
\r
43 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
44 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
45 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
46 List-Post: <mailto:notmuch@notmuchmail.org>
\r
47 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
48 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
49 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
50 X-List-Received-Date: Fri, 05 Nov 2010 15:05:06 -0000
\r
52 Remove double quotes and flatten "foo@bar.com <foo@bar.com>" to
\r
55 emacs/notmuch-show.el | 30 ++++++++++++++++++++++++++++--
\r
56 1 files changed, 28 insertions(+), 2 deletions(-)
\r
58 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
\r
59 index 07cf846..2838968 100644
\r
60 --- a/emacs/notmuch-show.el
\r
61 +++ b/emacs/notmuch-show.el
\r
64 (require 'mm-decode)
\r
66 +(require 'mail-parse)
\r
68 (require 'notmuch-lib)
\r
69 (require 'notmuch-query)
\r
70 @@ -204,12 +205,26 @@ same as that of the previous message."
\r
71 'face 'notmuch-tag-face)
\r
74 +(defun notmuch-show-clean-address (parsed-address)
\r
75 + "Clean a single email address for display."
\r
76 + (let ((address (car parsed-address))
\r
77 + (name (cdr parsed-address)))
\r
78 + ;; If the address is 'foo@bar.com <foo@bar.com>' then show just
\r
80 + (when (string= name address)
\r
85 + (concat name " <" address ">"))))
\r
87 (defun notmuch-show-insert-headerline (headers date tags depth)
\r
88 "Insert a notmuch style headerline based on HEADERS for a
\r
89 message at DEPTH in the current thread."
\r
90 (let ((start (point)))
\r
91 (insert (notmuch-show-spaces-n depth)
\r
92 - (plist-get headers :From)
\r
93 + (notmuch-show-clean-address
\r
94 + (mail-header-parse-address (plist-get headers :From)))
\r
98 @@ -220,7 +235,18 @@ message at DEPTH in the current thread."
\r
100 (defun notmuch-show-insert-header (header header-value)
\r
101 "Insert a single header."
\r
102 - (insert header ": " header-value "\n"))
\r
103 + (insert header ": "
\r
105 + ((or (string= "To" header)
\r
106 + (string= "Cc" header)
\r
107 + (string= "Bcc" header)
\r
108 + (string= "From" header))
\r
109 + (mapconcat 'notmuch-show-clean-address
\r
110 + (mail-header-parse-addresses header-value)
\r
116 (defun notmuch-show-insert-headers (headers)
\r
117 "Insert the headers of the current message."
\r