1 Return-Path: <tomi.ollila@iki.fi>
\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 9F0BD431FAF
\r
6 for <notmuch@notmuchmail.org>; Tue, 31 Jul 2012 00:47:14 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]
\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 vXrjVQMBqqCq for <notmuch@notmuchmail.org>;
\r
16 Tue, 31 Jul 2012 00:47:13 -0700 (PDT)
\r
17 Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])
\r
18 by olra.theworths.org (Postfix) with ESMTP id B73F1431FAE
\r
19 for <notmuch@notmuchmail.org>; Tue, 31 Jul 2012 00:47:13 -0700 (PDT)
\r
20 Received: by guru.guru-group.fi (Postfix, from userid 501)
\r
21 id 76F4710036F; Tue, 31 Jul 2012 10:47:22 +0300 (EEST)
\r
22 From: Tomi Ollila <tomi.ollila@iki.fi>
\r
23 To: Mark Walters <markwalters1009@gmail.com>, notmuch@notmuchmail.org
\r
24 Subject: Re: [PATCH] emacs: Split the function notmuch-show-clean-address
\r
25 In-Reply-To: <87ehnw84e5.fsf@qmul.ac.uk>
\r
26 References: <87ehnw84e5.fsf@qmul.ac.uk>
\r
27 User-Agent: Notmuch/0.13.2+103~g9610d35 (http://notmuchmail.org) Emacs/23.1.1
\r
28 (x86_64-redhat-linux-gnu)
\r
29 X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL
\r
30 $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F
\r
31 !)g;OY^,BjTbr)Np:%c_o'jj,Z
\r
32 Date: Tue, 31 Jul 2012 10:47:22 +0300
\r
33 Message-ID: <m2mx2gl6d1.fsf@guru.guru-group.fi>
\r
35 Content-Type: text/plain; charset=us-ascii
\r
36 X-BeenThere: notmuch@notmuchmail.org
\r
37 X-Mailman-Version: 2.1.13
\r
39 List-Id: "Use and development of the notmuch mail system."
\r
40 <notmuch.notmuchmail.org>
\r
41 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
42 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
43 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
44 List-Post: <mailto:notmuch@notmuchmail.org>
\r
45 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
46 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
47 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
48 X-List-Received-Date: Tue, 31 Jul 2012 07:47:14 -0000
\r
50 On Sat, Jul 28 2012, Mark Walters <markwalters1009@gmail.com> wrote:
\r
52 > This function is also used by pick so split it out. Since, pick and show
\r
53 > want a slightly different combination of name and email make the
\r
54 > separated function return them as a pair, and let show or pick extract
\r
55 > the combination they want from that.
\r
58 Put notmuch-clean-address before notmuch-show-clean-address so that
\r
59 byte compilation don't complain about missing function.
\r
61 (or move it to another file --- maybe later if it is sensible thing to do)
\r
63 You could return the name-address pair as cons cell instead of list (?).
\r
65 (If you continue to use list you can replace (car (cdr ...)) with (cadr ...))
\r
72 > This change allows the removal of about 50 lines of duplicated code from
\r
73 > notmuch-pick. Later, we may want to move the split out function to lib.
\r
75 > emacs/notmuch-show.el | 19 ++++++++++++++-----
\r
76 > 1 files changed, 14 insertions(+), 5 deletions(-)
\r
78 > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
\r
79 > index 6335d45..0d8569d 100644
\r
80 > --- a/emacs/notmuch-show.el
\r
81 > +++ b/emacs/notmuch-show.el
\r
82 > @@ -354,6 +354,19 @@ operation on the contents of the current buffer."
\r
83 > (defun notmuch-show-clean-address (address)
\r
84 > "Try to clean a single email ADDRESS for display. Return
\r
85 > unchanged ADDRESS if parsing fails."
\r
86 > + (let* ((clean-address (notmuch-clean-address address))
\r
87 > + (p-address (car clean-address))
\r
88 > + (p-name (car (cdr clean-address))))
\r
89 > + ;; If no name, return just the address.
\r
90 > + (if (not p-name)
\r
92 > + ;; Otherwise format the name and address together.
\r
93 > + (concat p-name " <" p-address ">"))))
\r
95 > +(defun notmuch-clean-address (address)
\r
96 > + "Try to clean a single email ADDRESS for display.
\r
97 > +Return (AUTHOR_EMAIL AUTHOR_NAME). Return (ADDRESS nil) if
\r
99 > (condition-case nil
\r
100 > (let (p-name p-address)
\r
101 > ;; It would be convenient to use `mail-header-parse-address',
\r
102 > @@ -401,11 +414,7 @@ unchanged ADDRESS if parsing fails."
\r
103 > (when (string= p-name p-address)
\r
104 > (setq p-name nil))
\r
106 > - ;; If no name results, return just the address.
\r
107 > - (if (not p-name)
\r
109 > - ;; Otherwise format the name and address together.
\r
110 > - (concat p-name " <" p-address ">")))
\r
111 > + (list p-address p-name))
\r
112 > (error address)))
\r
114 > (defun notmuch-show-insert-headerline (headers date tags depth)
\r
118 > _______________________________________________
\r
119 > notmuch mailing list
\r
120 > notmuch@notmuchmail.org
\r
121 > http://notmuchmail.org/mailman/listinfo/notmuch
\r