1 Return-Path: <m.walters@qmul.ac.uk>
\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 9D96A431FBF
\r
6 for <notmuch@notmuchmail.org>; Tue, 31 Jul 2012 09:25:59 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5
\r
12 tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001,
\r
13 NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled
\r
14 Received: from olra.theworths.org ([127.0.0.1])
\r
15 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
16 with ESMTP id IETcrRbkjLoz for <notmuch@notmuchmail.org>;
\r
17 Tue, 31 Jul 2012 09:25:58 -0700 (PDT)
\r
18 Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6])
\r
19 (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
\r
20 (No client certificate requested)
\r
21 by olra.theworths.org (Postfix) with ESMTPS id 322B7431FBD
\r
22 for <notmuch@notmuchmail.org>; Tue, 31 Jul 2012 09:25:58 -0700 (PDT)
\r
23 Received: from smtp.qmul.ac.uk ([138.37.6.40])
\r
24 by mail2.qmul.ac.uk with esmtp (Exim 4.71)
\r
25 (envelope-from <m.walters@qmul.ac.uk>)
\r
26 id 1SwFGZ-0005kp-V1; Tue, 31 Jul 2012 17:25:54 +0100
\r
27 Received: from 94-192-233-223.zone6.bethere.co.uk ([94.192.233.223]
\r
29 by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.69)
\r
30 (envelope-from <m.walters@qmul.ac.uk>)
\r
31 id 1SwFGZ-0002kp-Gy; Tue, 31 Jul 2012 17:25:51 +0100
\r
32 From: Mark Walters <markwalters1009@gmail.com>
\r
33 To: Tomi Ollila <tomi.ollila@iki.fi>, notmuch@notmuchmail.org
\r
34 Subject: Re: [PATCH] emacs: Split the function notmuch-show-clean-address
\r
35 In-Reply-To: <m2mx2gl6d1.fsf@guru.guru-group.fi>
\r
36 References: <87ehnw84e5.fsf@qmul.ac.uk> <m2mx2gl6d1.fsf@guru.guru-group.fi>
\r
37 User-Agent: Notmuch/0.13.2+96~g634443c (http://notmuchmail.org) Emacs/23.4.1
\r
38 (x86_64-pc-linux-gnu)
\r
39 Date: Tue, 31 Jul 2012 17:25:51 +0100
\r
40 Message-ID: <87boivzyls.fsf@qmul.ac.uk>
\r
42 Content-Type: text/plain; charset=us-ascii
\r
43 X-Sender-Host-Address: 94.192.233.223
\r
44 X-QM-SPAM-Info: Sender has good ham record. :)
\r
45 X-QM-Body-MD5: 960cb66c68eaa6edf5544b3d5f0877d3 (of first 20000 bytes)
\r
46 X-SpamAssassin-Score: -1.8
\r
47 X-SpamAssassin-SpamBar: -
\r
48 X-SpamAssassin-Report: The QM spam filters have analysed this message to
\r
50 spam. We require at least 5.0 points to mark a message as spam.
\r
51 This message scored -1.8 points.
\r
52 Summary of the scoring:
\r
53 * -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/,
\r
55 * [138.37.6.40 listed in list.dnswl.org]
\r
56 * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail
\r
57 provider * (markwalters1009[at]gmail.com)
\r
58 * -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay
\r
60 * 0.5 AWL AWL: From: address is in the auto white-list
\r
61 X-QM-Scan-Virus: ClamAV says the message is clean
\r
62 X-BeenThere: notmuch@notmuchmail.org
\r
63 X-Mailman-Version: 2.1.13
\r
65 List-Id: "Use and development of the notmuch mail system."
\r
66 <notmuch.notmuchmail.org>
\r
67 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
68 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
69 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
70 List-Post: <mailto:notmuch@notmuchmail.org>
\r
71 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
72 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
73 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
74 X-List-Received-Date: Tue, 31 Jul 2012 16:25:59 -0000
\r
76 On Tue, 31 Jul 2012, Tomi Ollila <tomi.ollila@iki.fi> wrote:
\r
77 > On Sat, Jul 28 2012, Mark Walters <markwalters1009@gmail.com> wrote:
\r
79 >> This function is also used by pick so split it out. Since, pick and show
\r
80 >> want a slightly different combination of name and email make the
\r
81 >> separated function return them as a pair, and let show or pick extract
\r
82 >> the combination they want from that.
\r
85 Many thanks for the review all these look clear improvements: I will
\r
86 post a new version as a reply to this email.
\r
88 > Put notmuch-clean-address before notmuch-show-clean-address so that
\r
89 > byte compilation don't complain about missing function.
\r
91 Fixed: I am curious though because I did not get any complaints from
\r
92 make. Are there some debug or similar things I should be setting?
\r
94 > (or move it to another file --- maybe later if it is sensible thing to do)
\r
96 I was vaguely thinking of moving it to lib after the split.
\r
98 > You could return the name-address pair as cons cell instead of list (?).
\r
100 This is a clear improvement.
\r
107 > (If you continue to use list you can replace (car (cdr ...)) with (cadr ...))
\r
114 >> This change allows the removal of about 50 lines of duplicated code from
\r
115 >> notmuch-pick. Later, we may want to move the split out function to lib.
\r
117 >> emacs/notmuch-show.el | 19 ++++++++++++++-----
\r
118 >> 1 files changed, 14 insertions(+), 5 deletions(-)
\r
120 >> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
\r
121 >> index 6335d45..0d8569d 100644
\r
122 >> --- a/emacs/notmuch-show.el
\r
123 >> +++ b/emacs/notmuch-show.el
\r
124 >> @@ -354,6 +354,19 @@ operation on the contents of the current buffer."
\r
125 >> (defun notmuch-show-clean-address (address)
\r
126 >> "Try to clean a single email ADDRESS for display. Return
\r
127 >> unchanged ADDRESS if parsing fails."
\r
128 >> + (let* ((clean-address (notmuch-clean-address address))
\r
129 >> + (p-address (car clean-address))
\r
130 >> + (p-name (car (cdr clean-address))))
\r
131 >> + ;; If no name, return just the address.
\r
132 >> + (if (not p-name)
\r
134 >> + ;; Otherwise format the name and address together.
\r
135 >> + (concat p-name " <" p-address ">"))))
\r
137 >> +(defun notmuch-clean-address (address)
\r
138 >> + "Try to clean a single email ADDRESS for display.
\r
139 >> +Return (AUTHOR_EMAIL AUTHOR_NAME). Return (ADDRESS nil) if
\r
140 >> +parsing fails."
\r
141 >> (condition-case nil
\r
142 >> (let (p-name p-address)
\r
143 >> ;; It would be convenient to use `mail-header-parse-address',
\r
144 >> @@ -401,11 +414,7 @@ unchanged ADDRESS if parsing fails."
\r
145 >> (when (string= p-name p-address)
\r
146 >> (setq p-name nil))
\r
148 >> - ;; If no name results, return just the address.
\r
149 >> - (if (not p-name)
\r
151 >> - ;; Otherwise format the name and address together.
\r
152 >> - (concat p-name " <" p-address ">")))
\r
153 >> + (list p-address p-name))
\r
154 >> (error address)))
\r
156 >> (defun notmuch-show-insert-headerline (headers date tags depth)
\r
160 >> _______________________________________________
\r
161 >> notmuch mailing list
\r
162 >> notmuch@notmuchmail.org
\r
163 >> http://notmuchmail.org/mailman/listinfo/notmuch
\r