Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / 0e / ad0f5c56a1babf7c76d3d5d43488703eee2f68
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 C274C431FC0\r
6         for <notmuch@notmuchmail.org>; Tue, 20 Mar 2012 18:33:15 -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: -1.098\r
10 X-Spam-Level: \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 24H-d0Z9a8gS for <notmuch@notmuchmail.org>;\r
17         Tue, 20 Mar 2012 18:33:13 -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 56EBD431FAF\r
22         for <notmuch@notmuchmail.org>; Tue, 20 Mar 2012 18:33:13 -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 1SAAQJ-0007xD-DF; Wed, 21 Mar 2012 01:33:11 +0000\r
27 Received: from 94-192-233-223.zone6.bethere.co.uk ([94.192.233.223]\r
28         helo=localhost)\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 1SAAQJ-0001h1-2n; Wed, 21 Mar 2012 01:33:11 +0000\r
32 From: Mark Walters <markwalters1009@gmail.com>\r
33 To: Pieter Praet <pieter@praet.org>, David Bremner <david@tethera.net>,\r
34         Dmitry Kurochkin <dmitry.kurochkin@gmail.com>\r
35 Subject: Re: [PATCH v2 4/6] emacs: add optional predicate arg to\r
36         `notmuch-show-mapc'\r
37 In-Reply-To: <1330122640-18895-5-git-send-email-pieter@praet.org>\r
38 References: <87wr7xqpuf.fsf@rocinante.cs.unb.ca>\r
39         <1330122640-18895-1-git-send-email-pieter@praet.org>\r
40         <1330122640-18895-5-git-send-email-pieter@praet.org>\r
41 User-Agent: Notmuch/0.12+67~g3bd579a (http://notmuchmail.org) Emacs/23.3.1\r
42         (x86_64-pc-linux-gnu)\r
43 Date: Wed, 21 Mar 2012 01:33:23 +0000\r
44 Message-ID: <87vclywxek.fsf@qmul.ac.uk>\r
45 MIME-Version: 1.0\r
46 Content-Type: text/plain; charset=us-ascii\r
47 X-Sender-Host-Address: 94.192.233.223\r
48 X-QM-SPAM-Info: Sender has good ham record.  :)\r
49 X-QM-Body-MD5: 6534a7ea8e0a3ce3bc264c37708c922b (of first 20000 bytes)\r
50 X-SpamAssassin-Score: -1.8\r
51 X-SpamAssassin-SpamBar: -\r
52 X-SpamAssassin-Report: The QM spam filters have analysed this message to\r
53         determine if it is\r
54         spam. We require at least 5.0 points to mark a message as spam.\r
55         This message scored -1.8 points.\r
56         Summary of the scoring: \r
57         * -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/,\r
58         *      medium trust\r
59         *      [138.37.6.40 listed in list.dnswl.org]\r
60         * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\r
61         provider *      (markwalters1009[at]gmail.com)\r
62         * -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay\r
63         *      domain\r
64         *  0.5 AWL AWL: From: address is in the auto white-list\r
65 X-QM-Scan-Virus: ClamAV says the message is clean\r
66 Cc: Notmuch Mail <notmuch@notmuchmail.org>\r
67 X-BeenThere: notmuch@notmuchmail.org\r
68 X-Mailman-Version: 2.1.13\r
69 Precedence: list\r
70 List-Id: "Use and development of the notmuch mail system."\r
71         <notmuch.notmuchmail.org>\r
72 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
73         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
74 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
75 List-Post: <mailto:notmuch@notmuchmail.org>\r
76 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
77 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
78         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
79 X-List-Received-Date: Wed, 21 Mar 2012 01:33:15 -0000\r
80 \r
81 On Fri, 24 Feb 2012 23:30:38 +0100, Pieter Praet <pieter@praet.org> wrote:\r
82 > * emacs/notmuch-show.el (notmuch-show-mapc):\r
83\r
84 >   If provided with optional argument PREDICATE, only call\r
85 >   FUNCTION if calling PREDICATE returns non-nil.\r
86\r
87 >   Also correct original docstring: 's/thread/buffer/'.\r
88 > ---\r
89 >  emacs/notmuch-show.el |   14 ++++++++++----\r
90 >  1 files changed, 10 insertions(+), 4 deletions(-)\r
91\r
92 > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
93 > index aa9ccee..6adbdc0 100644\r
94 > --- a/emacs/notmuch-show.el\r
95 > +++ b/emacs/notmuch-show.el\r
96 > @@ -1272,13 +1272,19 @@ (defun notmuch-show-goto-message-previous ()\r
97 >      (notmuch-show-move-to-message-top)\r
98 >      t))\r
99 >  \r
100 > -(defun notmuch-show-mapc (function)\r
101 > -  "Iterate through all messages in the current thread with\r
102 > +(defun notmuch-show-mapc (function &optional predicate)\r
103 > +  "Iterate through all messages in the current buffer with\r
104 >  `notmuch-show-goto-message-next' and call FUNCTION for side\r
105 > -effects."\r
106 > +effects.\r
107 > +\r
108 > +If provided with optional argument PREDICATE, only call\r
109 > +FUNCTION if calling PREDICATE returns non-nil."\r
110 >    (save-excursion\r
111 >      (goto-char (point-min))\r
112 > -    (loop do (funcall function)\r
113 > +    (loop do (if predicate\r
114 > +              (if (funcall predicate)\r
115 > +                  (funcall function))\r
116 > +            (funcall function))\r
117 >         while (notmuch-show-goto-message-next))))\r
118 >  \r
119 >  ;; Functions relating to the visibility of messages and their\r
120 \r
121 The change looks fine.\r
122 \r
123 The original function feels a little fragile to me as to what happens if\r
124 predicate or function move point. Eg what happens if function collapses\r
125 the message: where does point go, and so where does\r
126 notmuch-show-goto-message-next go. Is this just my naivete as a lisp\r
127 beginner? Is there someway of writing it so the user doesn't need to\r
128 worry about such things?\r
129 \r
130 Best wishes\r
131 \r
132 Mark\r
133 \r
134 (sorry for the duplicate mail: I sent the first message from the wrong address)\r
135 \r