1 Return-Path: <ethan.glasser.camp@gmail.com>
\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 B3A84431FB6
\r
6 for <notmuch@notmuchmail.org>; Mon, 15 Oct 2012 20:39:52 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5
\r
12 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
\r
13 FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] 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 c-w+WkD2Kk3M for <notmuch@notmuchmail.org>;
\r
17 Mon, 15 Oct 2012 20:39:51 -0700 (PDT)
\r
18 Received: from mail-qc0-f181.google.com (mail-qc0-f181.google.com
\r
19 [209.85.216.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))
\r
20 (No client certificate requested)
\r
21 by olra.theworths.org (Postfix) with ESMTPS id D6CCF431FAE
\r
22 for <notmuch@notmuchmail.org>; Mon, 15 Oct 2012 20:39:51 -0700 (PDT)
\r
23 Received: by mail-qc0-f181.google.com with SMTP id x40so5312744qcp.26
\r
24 for <notmuch@notmuchmail.org>; Mon, 15 Oct 2012 20:39:51 -0700 (PDT)
\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
\r
26 h=from:to:cc:subject:in-reply-to:references:user-agent:date
\r
27 :message-id:mime-version:content-type;
\r
28 bh=DwGiWcNJuuG9SrYxYn7qI9Ivh9B2CY4G419TURTY8VI=;
\r
29 b=V2omV3klcqiYcvYloPQfmOKy+WalfS3mnWA/utCBGEJrY3bo9oNMmPc2SX6ww+SxrL
\r
30 N5p4di6kB7324/gQZDC7aZPBI5KLL6sMD94qB+EpPjwMQJ+S3FSkLUFcC+IVU9Nh/Ebi
\r
31 khvIKVSkyZYU7He7FPepeKd6pUYdw4sgzKoQHC/y76uxMaOANFxTCrepgPgLXAh2C1EI
\r
32 oTbPl4bzRu+j/ywZn8lJsFuguG9NZrphIVYGoORRDRe9JQ/Yzg88Ilbb20VZD0A0xyrG
\r
33 wQbWJXPoENI6Op1N1fLpXkQTSWROHRuZbebPjbaqE2eEybw4/TJxZeKszwfdJytLSpZ5
\r
35 Received: by 10.224.189.5 with SMTP id dc5mr23621660qab.89.1350358791246;
\r
36 Mon, 15 Oct 2012 20:39:51 -0700 (PDT)
\r
37 Received: from smtp.gmail.com (p70-80.acedsl.com. [66.114.70.80])
\r
38 by mx.google.com with ESMTPS id cz8sm11608598qab.21.2012.10.15.20.39.49
\r
39 (version=TLSv1/SSLv3 cipher=OTHER);
\r
40 Mon, 15 Oct 2012 20:39:50 -0700 (PDT)
\r
41 From: Ethan Glasser-Camp <ethan.glasser.camp@gmail.com>
\r
42 To: Pieter Praet <pieter@praet.org>, David Bremner <david@tethera.net>,
\r
43 Dmitry Kurochkin <dmitry.kurochkin@gmail.com>
\r
44 Subject: Re: [PATCH v2 6/6] emacs: `notmuch-show-tag-all' with prefix arg only
\r
46 In-Reply-To: <1330122640-18895-7-git-send-email-pieter@praet.org>
\r
47 References: <87wr7xqpuf.fsf@rocinante.cs.unb.ca>
\r
48 <1330122640-18895-1-git-send-email-pieter@praet.org>
\r
49 <1330122640-18895-7-git-send-email-pieter@praet.org>
\r
50 User-Agent: Notmuch/0.14+45~g6ea9330 (http://notmuchmail.org) Emacs/23.3.1
\r
51 (x86_64-pc-linux-gnu)
\r
52 Date: Mon, 15 Oct 2012 23:39:47 -0400
\r
53 Message-ID: <87fw5f84qk.fsf@betacantrips.com>
\r
55 Content-Type: text/plain; charset=us-ascii
\r
56 Cc: Notmuch Mail <notmuch@notmuchmail.org>
\r
57 X-BeenThere: notmuch@notmuchmail.org
\r
58 X-Mailman-Version: 2.1.13
\r
60 List-Id: "Use and development of the notmuch mail system."
\r
61 <notmuch.notmuchmail.org>
\r
62 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
63 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
64 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
65 List-Post: <mailto:notmuch@notmuchmail.org>
\r
66 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
67 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
68 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
69 X-List-Received-Date: Tue, 16 Oct 2012 03:39:53 -0000
\r
71 Pieter Praet <pieter@praet.org> writes:
\r
73 > * emacs/notmuch-show.el
\r
75 > (notmuch-show-get-messages-ids):
\r
76 > If provided with optional argument PREDICATE, only return
\r
77 > Message-Id's of messages for which PREDICATE returns non-nil.
\r
79 > (notmuch-show-tag-all):
\r
80 > New argument ONLY-OPEN (set to `current-prefix-arg' if running
\r
81 > interactively): if non-nil, only change tags of *open* messages.
\r
82 > Also correct original docstring: 's/thread/buffer/'.
\r
84 > (notmuch-show-archive-thread):
\r
85 > Update wrt changes to `notmuch-show-tag-all'.
\r
89 > - Subtest "notmuch-show: change tags of open messages in current buffer"
\r
90 > is no longer broken...
\r
92 This patch is stale, but in case it helps..
\r
95 > emacs/notmuch-show.el | 33 ++++++++++++++++++++++++---------
\r
97 > 2 files changed, 24 insertions(+), 10 deletions(-)
\r
99 > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
\r
100 > index 05606fc..4bd1a7c 100644
\r
101 > --- a/emacs/notmuch-show.el
\r
102 > +++ b/emacs/notmuch-show.el
\r
103 > @@ -1339,14 +1339,18 @@ (defun notmuch-show-get-message-id ()
\r
104 > "Return the message id of the current message."
\r
105 > (concat "id:\"" (notmuch-show-get-prop :id) "\""))
\r
107 > -(defun notmuch-show-get-messages-ids (&optional separator)
\r
108 > +(defun notmuch-show-get-messages-ids (&optional separator predicate)
\r
109 > "Return a list of Message-Id's of all messages in the current buffer.
\r
111 > If provided with optional argument SEPARATOR, return a string
\r
112 > -instead, consisting of all Message-Id's separated by SEPARATOR."
\r
113 > +instead, consisting of all Message-Id's separated by SEPARATOR.
\r
115 > +If provided with optional argument PREDICATE, only return
\r
116 > +Message-Id's of messages for which PREDICATE returns non-nil."
\r
117 > (let ((message-ids))
\r
118 > (notmuch-show-mapc
\r
119 > - (lambda () (push (notmuch-show-get-message-id) message-ids)))
\r
120 > + (lambda () (push (notmuch-show-get-message-id) message-ids))
\r
123 > (mapconcat 'identity message-ids separator)
\r
125 > @@ -1633,18 +1637,29 @@ (defun notmuch-show-tag (&optional initial-input)
\r
126 > initial-input (notmuch-show-get-message-id))))
\r
127 > (apply 'notmuch-show-tag-message tag-changes)))
\r
129 > -(defun notmuch-show-tag-all (&rest tag-changes)
\r
130 > - "Change tags for all messages in the current thread.
\r
131 > +(defun notmuch-show-tag-all (only-open &rest tag-changes)
\r
132 > + "Change tags of all messages in the current buffer.
\r
134 I'm not crazy about notmuch-show-tag-all having an argument to control
\r
135 whether or not it tags all. Introduce another function, or perhaps
\r
136 change this one's name?
\r
138 I also don't really like that the only-open argument comes before the
\r
139 tag changes. This means changing every caller (although I guess there's
\r
140 just one right now). I think tag-changes are more important and should
\r
141 come first. (tag-changes are &optional instead of &rest in master, so
\r
142 you can just put only-open after instead of before.)
\r
145 > +If ONLY-OPEN is non-nil, only change tags of *open* messages in
\r
146 > +the current buffer.
\r
148 > TAG-CHANGES is a list of tag operations for `notmuch-tag'."
\r
149 > - (interactive (notmuch-read-tag-changes nil notmuch-show-thread-id))
\r
150 > - (apply 'notmuch-tag (notmuch-show-get-messages-ids " or ") tag-changes)
\r
151 > + (interactive (cons current-prefix-arg
\r
152 > + (notmuch-read-tag-changes nil notmuch-show-thread-id)))
\r
153 > + (apply 'notmuch-tag
\r
154 > + (notmuch-show-get-messages-ids
\r
157 > + ,(if only-open '(notmuch-show-message-visible-p) t)))
\r
160 This is a very awkward use of backquote, to my eyes. Besides, can't
\r
161 you just replace this with (if only-open 'notmuch-show-message-visible-p
\r
164 > (notmuch-show-mapc
\r
166 > (let* ((current-tags (notmuch-show-get-tags))
\r
167 > (new-tags (notmuch-update-tags current-tags tag-changes)))
\r
168 > (unless (equal current-tags new-tags)
\r
169 > - (notmuch-show-set-tags new-tags))))))
\r
170 > + (notmuch-show-set-tags new-tags))))
\r
172 > + ,(if only-open '(notmuch-show-message-visible-p) t))))
\r