Re: [PATCH v4 13/16] add indexopts to notmuch python bindings.
[notmuch-archives.git] / 58 / 582524e8a8f531462642bc0477c333c5c7dcf3
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 4F9DD40DAEA\r
6         for <notmuch@notmuchmail.org>; Tue,  9 Nov 2010 09:36:26 -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: -1.9\r
10 X-Spam-Level: \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 8lXq7+qhMBvj for <notmuch@notmuchmail.org>;\r
16         Tue,  9 Nov 2010 09:36:15 -0800 (PST)\r
17 Received: from mail-ew0-f53.google.com (mail-ew0-f53.google.com\r
18         [209.85.215.53])\r
19         by olra.theworths.org (Postfix) with ESMTP id AC3C940DAC6\r
20         for <notmuch@notmuchmail.org>; Tue,  9 Nov 2010 09:36:15 -0800 (PST)\r
21 Received: by ewy10 with SMTP id 10so4161115ewy.26\r
22         for <notmuch@notmuchmail.org>; Tue, 09 Nov 2010 09:36:13 -0800 (PST)\r
23 Received: by 10.216.0.7 with SMTP id 7mr7165800wea.22.1289324172811;\r
24         Tue, 09 Nov 2010 09:36:12 -0800 (PST)\r
25 Received: from ut.hh.sledj.net (host81-149-164-25.in-addr.btopenworld.com\r
26         [81.149.164.25])\r
27         by mx.google.com with ESMTPS id 7sm1046210wet.24.2010.11.09.09.36.06\r
28         (version=TLSv1/SSLv3 cipher=RC4-MD5);\r
29         Tue, 09 Nov 2010 09:36:07 -0800 (PST)\r
30 Received: by ut.hh.sledj.net (Postfix, from userid 1000)\r
31         id D8AA359405B; Tue,  9 Nov 2010 17:34:51 +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: Tue,  9 Nov 2010 17:34:50 +0000\r
36 Message-Id: <1289324090-25246-1-git-send-email-dme@dme.org>\r
37 X-Mailer: git-send-email 1.7.2.3\r
38 In-Reply-To: <1288969456-15997-1-git-send-email-dme@dme.org>\r
39 References: <1288969456-15997-1-git-send-email-dme@dme.org>\r
40 X-BeenThere: notmuch@notmuchmail.org\r
41 X-Mailman-Version: 2.1.13\r
42 Precedence: list\r
43 List-Id: "Use and development of the notmuch mail system."\r
44         <notmuch.notmuchmail.org>\r
45 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
46         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
47 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
48 List-Post: <mailto:notmuch@notmuchmail.org>\r
49 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
50 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
51         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
52 X-List-Received-Date: Tue, 09 Nov 2010 17:36:26 -0000\r
53 \r
54 Remove double quotes and flatten "foo@bar.com <foo@bar.com>" to\r
55 "foo@bar.com". If the address is of the form "name <foo@bar.com>",\r
56 show only 'name' with a tooltip of the address.\r
57 ---\r
58 More aggressive simplification and tooltips.\r
59 \r
60  emacs/notmuch-show.el |   29 +++++++++++++++++++++++++++--\r
61  1 files changed, 27 insertions(+), 2 deletions(-)\r
62 \r
63 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
64 index 9e5d72d..098146b 100644\r
65 --- a/emacs/notmuch-show.el\r
66 +++ b/emacs/notmuch-show.el\r
67 @@ -26,6 +26,7 @@\r
68  (require 'message)\r
69  (require 'mm-decode)\r
70  (require 'mailcap)\r
71 +(require 'mail-parse)\r
72  \r
73  (require 'notmuch-lib)\r
74  (require 'notmuch-query)\r
75 @@ -198,12 +199,25 @@ any given message."\r
76                                              'face 'notmuch-tag-face)\r
77                                  ")"))))))\r
78  \r
79 +(defun notmuch-show-clean-address (parsed-address)\r
80 +  "Prepare a single email address for display."\r
81 +  (let ((address (car parsed-address))\r
82 +       (name (cdr parsed-address)))\r
83 +    ;; If the address is 'foo@bar.com <foo@bar.com>' then show just\r
84 +    ;; 'foo@bar.com'.\r
85 +    (when (string= name address)\r
86 +      (setq name nil))\r
87 +    (if name\r
88 +       (propertize name 'help-echo address)\r
89 +       address)))\r
90 +\r
91  (defun notmuch-show-insert-headerline (headers date tags depth)\r
92    "Insert a notmuch style headerline based on HEADERS for a\r
93  message at DEPTH in the current thread."\r
94    (let ((start (point)))\r
95      (insert (notmuch-show-spaces-n depth)\r
96 -           (plist-get headers :From)\r
97 +           (notmuch-show-clean-address\r
98 +            (mail-header-parse-address (plist-get headers :From)))\r
99             " ("\r
100             date\r
101             ") ("\r
102 @@ -214,7 +228,18 @@ message at DEPTH in the current thread."\r
103  \r
104  (defun notmuch-show-insert-header (header header-value)\r
105    "Insert a single header."\r
106 -  (insert header ": " header-value "\n"))\r
107 +  (insert header ": "\r
108 +         (cond\r
109 +          ((or (string= "To" header)\r
110 +               (string= "Cc" header)\r
111 +               (string= "Bcc" header)\r
112 +               (string= "From" header))\r
113 +           (mapconcat 'notmuch-show-clean-address\r
114 +                      (mail-header-parse-addresses header-value)\r
115 +                      ", "))\r
116 +          (t\r
117 +           header-value))\r
118 +         "\n"))\r
119  \r
120  (defun notmuch-show-insert-headers (headers)\r
121    "Insert the headers of the current message."\r
122 -- \r
123 1.7.2.3\r
124 \r