Re: [PATCH v4 01/16] add util/search-path.{c, h} to test for executables in $PATH
[notmuch-archives.git] / 6f / 78e12a0124110636f2748746404f417fc8fbeb
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 6B38F431FAF\r
6         for <notmuch@notmuchmail.org>; Tue, 31 Jul 2012 10:59:32 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
12         autolearn=disabled\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 DpZdulzsrYRW for <notmuch@notmuchmail.org>;\r
16         Tue, 31 Jul 2012 10:59:31 -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 8BA0C431FAE\r
19         for <notmuch@notmuchmail.org>; Tue, 31 Jul 2012 10:59:31 -0700 (PDT)\r
20 Received: by guru.guru-group.fi (Postfix, from userid 501)\r
21         id 95BD110036F; Tue, 31 Jul 2012 20:59:40 +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 v2] emacs: Split the function notmuch-show-clean-address\r
25 In-Reply-To: <878vdzzyfg.fsf@qmul.ac.uk>\r
26 References: <87ehnw84e5.fsf@qmul.ac.uk> <m2mx2gl6d1.fsf@guru.guru-group.fi>\r
27         <87boivzyls.fsf@qmul.ac.uk> <878vdzzyfg.fsf@qmul.ac.uk>\r
28 User-Agent: Notmuch/0.13.2+103~g9610d35 (http://notmuchmail.org) Emacs/23.1.1\r
29         (x86_64-redhat-linux-gnu)\r
30 X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
31         $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
32         !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
33 Date: Tue, 31 Jul 2012 20:59:40 +0300\r
34 Message-ID: <m21ujrn75f.fsf@guru.guru-group.fi>\r
35 MIME-Version: 1.0\r
36 Content-Type: text/plain; charset=us-ascii\r
37 X-BeenThere: notmuch@notmuchmail.org\r
38 X-Mailman-Version: 2.1.13\r
39 Precedence: list\r
40 List-Id: "Use and development of the notmuch mail system."\r
41         <notmuch.notmuchmail.org>\r
42 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
43         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
44 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
45 List-Post: <mailto:notmuch@notmuchmail.org>\r
46 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
47 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
48         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
49 X-List-Received-Date: Tue, 31 Jul 2012 17:59:32 -0000\r
50 \r
51 On Tue, Jul 31 2012, Mark Walters <markwalters1009@gmail.com> wrote:\r
52 \r
53 > This function is also used by pick so split it out in preperation for\r
54 > moving to lib. In fact, pick and show want a slightly different\r
55 > combination of name and email on return so make the separated function\r
56 > return them as a pair, and let show or pick extract the combination\r
57 > they want from that.\r
58 > ---\r
59 >  emacs/notmuch-show.el |   27 ++++++++++++++++++---------\r
60 >  1 files changed, 18 insertions(+), 9 deletions(-)\r
61 >\r
62 > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
63 > index 6335d45..4ab6f92 100644\r
64 > --- a/emacs/notmuch-show.el\r
65 > +++ b/emacs/notmuch-show.el\r
66 > @@ -351,9 +351,10 @@ operation on the contents of the current buffer."\r
67 >                                            'face 'notmuch-tag-face)\r
68 >                                ")"))))))\r
69 >  \r
70 > -(defun notmuch-show-clean-address (address)\r
71 > -  "Try to clean a single email ADDRESS for display.  Return\r
72 > -unchanged ADDRESS if parsing fails."\r
73 > +(defun notmuch-clean-address (address)\r
74 > +  "Try to clean a single email ADDRESS for display. Return a cons\r
75 > +cell of (AUTHOR_EMAIL AUTHOR_NAME). Return (ADDRESS nil) if\r
76 > +parsing fails."\r
77 \r
78 Looks good to me.\r
79 \r
80 It took a few iterations to understand that the error case in expression\r
81 below can be experimented with:\r
82 \r
83 (condition-case nil (error "caught") (error (cons "car" "cdr"))) c-x c-e\r
84 \r
85 Tomi\r
86 \r
87 >    (condition-case nil\r
88 >      (let (p-name p-address)\r
89 >        ;; It would be convenient to use `mail-header-parse-address',\r
90 > @@ -401,12 +402,20 @@ unchanged ADDRESS if parsing fails."\r
91 >        (when (string= p-name p-address)\r
92 >       (setq p-name nil))\r
93 >  \r
94 > -      ;; If no name results, return just the address.\r
95 > -      (if (not p-name)\r
96 > -       p-address\r
97 > -     ;; Otherwise format the name and address together.\r
98 > -     (concat p-name " <" p-address ">")))\r
99 > -    (error address)))\r
100 > +      (cons p-address p-name))\r
101 > +    (error (cons address nil))))\r
102 > +\r
103 > +(defun notmuch-show-clean-address (address)\r
104 > +  "Try to clean a single email ADDRESS for display.  Return\r
105 > +unchanged ADDRESS if parsing fails."\r
106 > +  (let* ((clean-address (notmuch-clean-address address))\r
107 > +      (p-address (car clean-address))\r
108 > +      (p-name (cdr clean-address)))\r
109 > +    ;; If no name, return just the address.\r
110 > +    (if (not p-name)\r
111 > +     p-address\r
112 > +      ;; Otherwise format the name and address together.\r
113 > +      (concat p-name " <" p-address ">"))))\r
114 >  \r
115 >  (defun notmuch-show-insert-headerline (headers date tags depth)\r
116 >    "Insert a notmuch style headerline based on HEADERS for a\r
117 > -- \r
118 > 1.7.9.1\r
119 >\r
120 > _______________________________________________\r
121 > notmuch mailing list\r
122 > notmuch@notmuchmail.org\r
123 > http://notmuchmail.org/mailman/listinfo/notmuch\r