1 Return-Path: <dmitry.kurochkin@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 9EFC4403E3E
\r
6 for <notmuch@notmuchmail.org>; Fri, 24 Feb 2012 02:48:57 -0800 (PST)
\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 2tfC4MufaMCG for <notmuch@notmuchmail.org>;
\r
17 Fri, 24 Feb 2012 02:48:56 -0800 (PST)
\r
18 Received: from mail-bk0-f53.google.com (mail-bk0-f53.google.com
\r
19 [209.85.214.53]) (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 CB9AC40BC64
\r
22 for <notmuch@notmuchmail.org>; Fri, 24 Feb 2012 02:48:55 -0800 (PST)
\r
23 Received: by bkcit16 with SMTP id it16so2026518bkc.26
\r
24 for <notmuch@notmuchmail.org>; Fri, 24 Feb 2012 02:48:54 -0800 (PST)
\r
25 Received-SPF: pass (google.com: domain of dmitry.kurochkin@gmail.com
\r
26 designates 10.205.137.4 as permitted sender)
\r
27 client-ip=10.205.137.4;
\r
28 Authentication-Results: mr.google.com; spf=pass (google.com: domain of
\r
29 dmitry.kurochkin@gmail.com designates 10.205.137.4 as permitted
\r
30 sender) smtp.mail=dmitry.kurochkin@gmail.com;
\r
31 dkim=pass header.i=dmitry.kurochkin@gmail.com
\r
32 Received: from mr.google.com ([10.205.137.4])
\r
33 by 10.205.137.4 with SMTP id im4mr798946bkc.136.1330080534423 (num_hops
\r
34 = 1); Fri, 24 Feb 2012 02:48:54 -0800 (PST)
\r
35 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
\r
36 h=from:to:cc:subject:in-reply-to:references:user-agent:date
\r
37 :message-id:mime-version:content-type;
\r
38 bh=Kc4HyIXOqwcMKjafbL9sl4PYrI8qnOfsZfyTHIIEwrM=;
\r
39 b=wXPC+kshF/QywXsrYSF3YxmflWWQxslMLP/cr6HsDbOdnYgzVCheOV882J0o4/ux8P
\r
40 jgEPlfsG+n8kt7WZzxQuUlJ9oq2E7tYU/FHiZRfKKHIXhPXkWrh4ECxtyg9R7y9KNXdh
\r
41 7Ra5Fzg6VwCb51+1EauxxneQ+4xcuA64mh9Vk=
\r
42 Received: by 10.205.137.4 with SMTP id im4mr664982bkc.136.1330080534343;
\r
43 Fri, 24 Feb 2012 02:48:54 -0800 (PST)
\r
44 Received: from localhost ([91.144.186.21])
\r
45 by mx.google.com with ESMTPS id jd17sm7920907bkb.4.2012.02.24.02.48.53
\r
46 (version=TLSv1/SSLv3 cipher=OTHER);
\r
47 Fri, 24 Feb 2012 02:48:53 -0800 (PST)
\r
48 From: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>
\r
49 To: Pieter Praet <pieter@praet.org>, David Bremner <david@tethera.net>
\r
50 Subject: Re: [PATCH 6/6] emacs: `notmuch-show-tag-all' sans prefix arg only
\r
52 In-Reply-To: <1330038554-10347-6-git-send-email-pieter@praet.org>
\r
53 References: <878vjtqhcg.fsf@praet.org>
\r
54 <1330038554-10347-6-git-send-email-pieter@praet.org>
\r
55 User-Agent: Notmuch/0.11.1+188~ga5674c2 (http://notmuchmail.org) Emacs/23.3.1
\r
56 (x86_64-pc-linux-gnu)
\r
57 Date: Fri, 24 Feb 2012 14:47:30 +0400
\r
58 Message-ID: <87aa48jynx.fsf@gmail.com>
\r
60 Content-Type: text/plain; charset=us-ascii
\r
61 Cc: Notmuch Mail <notmuch@notmuchmail.org>
\r
62 X-BeenThere: notmuch@notmuchmail.org
\r
63 X-Mailman-Version: 2.1.13
\r
65 List-Id: "Use and development of the notmuch mail system."
\r
66 <notmuch.notmuchmail.org>
\r
67 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
68 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
69 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
70 List-Post: <mailto:notmuch@notmuchmail.org>
\r
71 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
72 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
73 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
74 X-List-Received-Date: Fri, 24 Feb 2012 10:48:58 -0000
\r
76 On Fri, 24 Feb 2012 00:09:14 +0100, Pieter Praet <pieter@praet.org> wrote:
\r
77 > * emacs/notmuch-show.el
\r
79 > (notmuch-show-get-messages-ids):
\r
80 > New optional argument ONLY-OPEN. If non-nil, only return
\r
81 > Message-Id's for messages which are currently visible.
\r
83 > (notmuch-show-tag-all):
\r
84 > New optional argument IGNORE-VISIBILITY, of which the inverse is
\r
85 > passed as ONLY-OPEN argument to `notmuch-show-get-messages-ids':
\r
86 > If called with a prefix arg, affect *all* messages in the current
\r
87 > buffer. Otherwise, only change tags of visible messages.
\r
89 > (notmuch-show-archive-thread):
\r
90 > Update wrt changes to `notmuch-show-tag-all'.
\r
94 > - Subtest "notmuch-show: change tags of open messages in current buffer"
\r
95 > is no longer broken.
\r
97 > emacs/notmuch-show.el | 28 ++++++++++++++++++++--------
\r
99 > 2 files changed, 20 insertions(+), 9 deletions(-)
\r
101 > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
\r
102 > index 4b37c77..4499fcd 100644
\r
103 > --- a/emacs/notmuch-show.el
\r
104 > +++ b/emacs/notmuch-show.el
\r
105 > @@ -1334,13 +1334,17 @@ (defun notmuch-show-get-message-id ()
\r
106 > "Return the message id of the current message."
\r
107 > (concat "id:\"" (notmuch-show-get-prop :id) "\""))
\r
109 > -(defun notmuch-show-get-messages-ids (&optional separator)
\r
110 > +(defun notmuch-show-get-messages-ids (&optional only-open separator)
\r
111 > "Return a list of Message-Id's of all messages in the current buffer.
\r
113 > +If optional argument ONLY-OPEN is non-nil, only return
\r
114 > +Message-Id's for messages which are currently visible.
\r
116 > If provided with optional argument SEPARATOR, return a string
\r
117 > instead, consisting of all Message-Id's separated by SEPARATOR."
\r
118 > (let ((message-ids))
\r
119 > - (notmuch-show-mapc t
\r
120 > + (notmuch-show-mapc
\r
121 > + `(if only-open (notmuch-show-message-visible-p) t)
\r
123 How about changing ONLY-OPEN to a general optional PREDICATE argument
\r
124 and pass it as is to `notmuch-show-mapc'? Please make it the last
\r
130 > (lambda () (push (notmuch-show-get-message-id) message-ids)))
\r
132 > (mapconcat 'identity message-ids separator)
\r
133 > @@ -1628,13 +1632,21 @@ (defun notmuch-show-tag (&optional initial-input)
\r
134 > initial-input (notmuch-show-get-message-id))))
\r
135 > (apply 'notmuch-show-tag-message tag-changes)))
\r
137 > -(defun notmuch-show-tag-all (&rest tag-changes)
\r
138 > - "Change tags for all messages in the current thread.
\r
139 > +(defun notmuch-show-tag-all (&optional ignore-visibility &rest tag-changes)
\r
140 > + "Change tags of all open messages in the current buffer.
\r
142 > +If optional arg IGNORE-VISIBILITY is non-nil, change tags of
\r
143 > +*all* messages in the current buffer, independent of their
\r
146 > TAG-CHANGES is a list of tag operations for `notmuch-tag'."
\r
147 > - (interactive (notmuch-read-tag-changes nil notmuch-show-thread-id))
\r
148 > - (apply 'notmuch-tag (notmuch-show-get-messages-ids " or ") tag-changes)
\r
149 > - (notmuch-show-mapc t
\r
150 > + (interactive (cons current-prefix-arg
\r
151 > + (notmuch-read-tag-changes nil notmuch-show-thread-id)))
\r
152 > + (apply 'notmuch-tag
\r
153 > + (notmuch-show-get-messages-ids (not ignore-visibility) " or ")
\r
155 > + (notmuch-show-mapc
\r
156 > + `(if ignore-visibility t (notmuch-show-message-visible-p))
\r
158 > (let* ((current-tags (notmuch-show-get-tags))
\r
159 > (new-tags (notmuch-update-tags current-tags tag-changes)))
\r
160 > @@ -1719,7 +1731,7 @@ (defun notmuch-show-archive-thread (&optional unarchive)
\r
162 > (interactive "P")
\r
163 > (let ((op (if unarchive "+" "-")))
\r
164 > - (notmuch-show-tag-all (concat op "inbox"))))
\r
165 > + (notmuch-show-tag-all t (concat op "inbox"))))
\r
167 > (defun notmuch-show-archive-thread-then-next ()
\r
168 > "Archive each message in thread, then show next thread from search."
\r
169 > diff --git a/test/emacs b/test/emacs
\r
170 > index 644ef59..c286ff5 100755
\r
173 > @@ -152,7 +152,6 @@ notmuch tag +"$del_tag" -"$add_tag" -- "$query" # revert tag changes
\r
174 > test_expect_equal "$count_changed" "$count_total" # assert that CHANGED == TOTAL
\r
176 > test_begin_subtest "notmuch-show: change tags of open messages in current buffer"
\r
177 > -test_subtest_known_broken
\r
178 > query="$os_x_darwin_thread"
\r
179 > filter="from:Jiang"
\r
180 > add_tag="notmuch-show-tag-all"
\r