Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / 73 / e2228a906ebe62d4c6e13bee44d1f2fbad8255
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
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 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
34 MIME-Version: 1.0\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
38 Precedence: list\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
49 \r
50 On Sat, Jul 28 2012, Mark Walters <markwalters1009@gmail.com> wrote:\r
51 \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
56 > ---\r
57 \r
58 Put notmuch-clean-address before notmuch-show-clean-address so that\r
59 byte compilation don't complain about missing function.\r
60 \r
61 (or move it to another file --- maybe later if it is sensible thing to do)\r
62 \r
63 You could return the name-address pair as cons cell instead of list (?).\r
64 \r
65 (If you continue to use list you can replace (car (cdr ...)) with (cadr ...))\r
66 \r
67 Anyway, LGTM.\r
68 \r
69 Tomi\r
70 \r
71 >\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
74 >\r
75 >  emacs/notmuch-show.el |   19 ++++++++++++++-----\r
76 >  1 files changed, 14 insertions(+), 5 deletions(-)\r
77 >\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
91 > +     p-address\r
92 > +      ;; Otherwise format the name and address together.\r
93 > +      (concat p-name " <" p-address ">"))))\r
94 > +\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
98 > +parsing fails."\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
105 >  \r
106 > -      ;; If no name results, return just the address.\r
107 > -      (if (not p-name)\r
108 > -       p-address\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
113 >  \r
114 >  (defun notmuch-show-insert-headerline (headers date tags depth)\r
115 > -- \r
116 > 1.7.9.1\r
117 >\r
118 > _______________________________________________\r
119 > notmuch mailing list\r
120 > notmuch@notmuchmail.org\r
121 > http://notmuchmail.org/mailman/listinfo/notmuch\r