1 Return-Path: <pieter@praet.org>
\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 82C10415E4A
\r
6 for <notmuch@notmuchmail.org>; Fri, 24 Feb 2012 14:37:47 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5
\r
12 tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 B0iQdi6cWHGp for <notmuch@notmuchmail.org>;
\r
16 Fri, 24 Feb 2012 14:37:46 -0800 (PST)
\r
17 Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com
\r
18 [209.85.212.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))
\r
19 (No client certificate requested)
\r
20 by olra.theworths.org (Postfix) with ESMTPS id B0649415E49
\r
21 for <notmuch@notmuchmail.org>; Fri, 24 Feb 2012 14:37:46 -0800 (PST)
\r
22 Received: by wibhi8 with SMTP id hi8so2010781wib.26
\r
23 for <notmuch@notmuchmail.org>; Fri, 24 Feb 2012 14:37:45 -0800 (PST)
\r
24 Received-SPF: pass (google.com: domain of pieter@praet.org designates
\r
25 10.180.97.130 as permitted sender) client-ip=10.180.97.130;
\r
26 Authentication-Results: mr.google.com;
\r
27 spf=pass (google.com: domain of pieter@praet.org
\r
28 designates 10.180.97.130 as permitted sender)
\r
29 smtp.mail=pieter@praet.org
\r
30 Received: from mr.google.com ([10.180.97.130])
\r
31 by 10.180.97.130 with SMTP id ea2mr8787045wib.20.1330123065583
\r
32 (num_hops = 1); Fri, 24 Feb 2012 14:37:45 -0800 (PST)
\r
33 Received: by 10.180.97.130 with SMTP id ea2mr7087381wib.20.1330123065508;
\r
34 Fri, 24 Feb 2012 14:37:45 -0800 (PST)
\r
35 Received: from localhost ([109.131.181.26])
\r
36 by mx.google.com with ESMTPS id bg3sm6293527wib.10.2012.02.24.14.37.44
\r
37 (version=TLSv1/SSLv3 cipher=OTHER);
\r
38 Fri, 24 Feb 2012 14:37:45 -0800 (PST)
\r
39 From: Pieter Praet <pieter@praet.org>
\r
40 To: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>,
\r
41 David Bremner <david@tethera.net>
\r
42 Subject: Re: [PATCH 4/6] emacs: add predicate arg to `notmuch-show-mapc'
\r
43 In-Reply-To: <87fwe0jz0y.fsf@gmail.com>
\r
44 References: <878vjtqhcg.fsf@praet.org>
\r
45 <1330038554-10347-4-git-send-email-pieter@praet.org>
\r
46 <87fwe0jz0y.fsf@gmail.com>
\r
47 User-Agent: Notmuch/0.11.1+210~g6afc43e (http://notmuchmail.org) Emacs/23.3.1
\r
48 (x86_64-unknown-linux-gnu)
\r
49 Date: Fri, 24 Feb 2012 23:35:26 +0100
\r
50 Message-ID: <877gzbeu6p.fsf@praet.org>
\r
52 Content-Type: text/plain; charset=us-ascii
\r
54 ALoCoQk4Ikp37f5TAcI+he1a7VaRWUhEkvtpAA9c5pwCnsxKAr+cxbZ30ZbJoOs382dQBtQIU3HS
\r
55 Cc: Notmuch Mail <notmuch@notmuchmail.org>
\r
56 X-BeenThere: notmuch@notmuchmail.org
\r
57 X-Mailman-Version: 2.1.13
\r
59 List-Id: "Use and development of the notmuch mail system."
\r
60 <notmuch.notmuchmail.org>
\r
61 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
62 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
63 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
64 List-Post: <mailto:notmuch@notmuchmail.org>
\r
65 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
66 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
67 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
68 X-List-Received-Date: Fri, 24 Feb 2012 22:37:47 -0000
\r
70 On Fri, 24 Feb 2012 14:39:41 +0400, Dmitry Kurochkin <dmitry.kurochkin@gmail.com> wrote:
\r
71 > On Fri, 24 Feb 2012 00:09:12 +0100, Pieter Praet <pieter@praet.org> wrote:
\r
72 > > * emacs/notmuch-show.el
\r
74 > > (notmuch-show-mapc):
\r
75 > > Only call FUNCTION if new argument PREDICATE is satisfied.
\r
76 > > Also correct original docstring: 's/thread/buffer/'.
\r
78 > > (notmuch-show-get-messages-ids):
\r
79 > > Update wrt changes to `notmuch-show-mapc'.
\r
81 > > (notmuch-show-tag-all):
\r
82 > > Update wrt changes to `notmuch-show-mapc'.
\r
84 > > emacs/notmuch-show.el | 15 ++++++++-------
\r
85 > > 1 files changed, 8 insertions(+), 7 deletions(-)
\r
87 > > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
\r
88 > > index aa9ccee..5fc0e43 100644
\r
89 > > --- a/emacs/notmuch-show.el
\r
90 > > +++ b/emacs/notmuch-show.el
\r
91 > > @@ -1272,13 +1272,14 @@ (defun notmuch-show-goto-message-previous ()
\r
92 > > (notmuch-show-move-to-message-top)
\r
95 > > -(defun notmuch-show-mapc (function)
\r
96 > > - "Iterate through all messages in the current thread with
\r
97 > > -`notmuch-show-goto-message-next' and call FUNCTION for side
\r
99 > > +(defun notmuch-show-mapc (predicate function)
\r
101 > Please make PREDICATE optional to avoid giving t when it is not needed.
\r
106 > I would expect PREDICATE to be a function, [...]
\r
108 Well, it *can* be a function actually (see later usage in e.g.
\r
109 `notmuch-show-get-messages-ids' [1]), but should be provided
\r
110 as a form instead of as a quoted symbol.
\r
112 > [...] but perhaps the way you
\r
113 > implemented it is common in Emacs.
\r
116 Far from it, apparently. I did it that way to prevent `funcall' from
\r
117 choking on t/nil, which -in retrospect- was rather shortsighted...
\r
119 I've used a more sensible approach in v2 [2].
\r
124 > > + "Iterate through all messages in the current buffer with
\r
125 > > +`notmuch-show-goto-message-next'. If PREDICATE is satisfied,
\r
126 > > +call FUNCTION for side effects."
\r
127 > > (save-excursion
\r
128 > > (goto-char (point-min))
\r
129 > > - (loop do (funcall function)
\r
130 > > + (loop do (if (eval predicate)
\r
131 > > + (funcall function))
\r
132 > > while (notmuch-show-goto-message-next))))
\r
134 > > ;; Functions relating to the visibility of messages and their
\r
135 > > @@ -1336,7 +1337,7 @@ (defun notmuch-show-get-message-id ()
\r
136 > > (defun notmuch-show-get-messages-ids ()
\r
137 > > "Return all message ids of messages in the current thread."
\r
138 > > (let ((message-ids))
\r
139 > > - (notmuch-show-mapc
\r
140 > > + (notmuch-show-mapc t
\r
141 > > (lambda () (push (notmuch-show-get-message-id) message-ids)))
\r
144 > > @@ -1633,7 +1634,7 @@ (defun notmuch-show-tag-all (&rest tag-changes)
\r
145 > > TAG-CHANGES is a list of tag operations for `notmuch-tag'."
\r
146 > > (interactive (notmuch-read-tag-changes nil notmuch-show-thread-id))
\r
147 > > (apply 'notmuch-tag (notmuch-show-get-messages-ids-search) tag-changes)
\r
148 > > - (notmuch-show-mapc
\r
149 > > + (notmuch-show-mapc t
\r
151 > > (let* ((current-tags (notmuch-show-get-tags))
\r
152 > > (new-tags (notmuch-update-tags current-tags tag-changes)))
\r
163 [1] id:"1330038554-10347-6-git-send-email-pieter@praet.org"
\r
164 [2] id:"1330122640-18895-5-git-send-email-pieter@praet.org"
\r