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 A47E1416159
\r
6 for <notmuch@notmuchmail.org>; Fri, 24 Feb 2012 14:39:26 -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 zroAcE2HhnVK for <notmuch@notmuchmail.org>;
\r
16 Fri, 24 Feb 2012 14:39:26 -0800 (PST)
\r
17 Received: from mail-ww0-f45.google.com (mail-ww0-f45.google.com
\r
18 [74.125.82.45]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client
\r
19 certificate requested) by olra.theworths.org (Postfix) with ESMTPS id
\r
20 D5589416158 for <notmuch@notmuchmail.org>; Fri, 24 Feb 2012 14:39:25 -0800
\r
22 Received: by wgbdt12 with SMTP id dt12so2229215wgb.2
\r
23 for <notmuch@notmuchmail.org>; Fri, 24 Feb 2012 14:39:24 -0800 (PST)
\r
24 Received-SPF: pass (google.com: domain of pieter@praet.org designates
\r
25 10.180.24.166 as permitted sender) client-ip=10.180.24.166;
\r
26 Authentication-Results: mr.google.com;
\r
27 spf=pass (google.com: domain of pieter@praet.org
\r
28 designates 10.180.24.166 as permitted sender)
\r
29 smtp.mail=pieter@praet.org
\r
30 Received: from mr.google.com ([10.180.24.166])
\r
31 by 10.180.24.166 with SMTP id v6mr9131891wif.10.1330123164674 (num_hops
\r
32 = 1); Fri, 24 Feb 2012 14:39:24 -0800 (PST)
\r
33 Received: by 10.180.24.166 with SMTP id v6mr7271604wif.10.1330123164552;
\r
34 Fri, 24 Feb 2012 14:39:24 -0800 (PST)
\r
35 Received: from localhost ([109.131.181.26])
\r
36 by mx.google.com with ESMTPS id by4sm423844wib.3.2012.02.24.14.39.23
\r
37 (version=TLSv1/SSLv3 cipher=OTHER);
\r
38 Fri, 24 Feb 2012 14:39:24 -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 6/6] emacs: `notmuch-show-tag-all' sans prefix arg only
\r
44 In-Reply-To: <87aa48jynx.fsf@gmail.com>
\r
45 References: <878vjtqhcg.fsf@praet.org>
\r
46 <1330038554-10347-6-git-send-email-pieter@praet.org>
\r
47 <87aa48jynx.fsf@gmail.com>
\r
48 User-Agent: Notmuch/0.11.1+210~g6afc43e (http://notmuchmail.org) Emacs/23.3.1
\r
49 (x86_64-unknown-linux-gnu)
\r
50 Date: Fri, 24 Feb 2012 23:37:10 +0100
\r
51 Message-ID: <871upjeu3t.fsf@praet.org>
\r
53 Content-Type: text/plain; charset=us-ascii
\r
55 ALoCoQlg+iUFZN+D9zv7E3Fkk8zQn4jJl0lW/TDew5MkSlPFwGOtLx015OwI3yr9632UNEwWhS75
\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: Fri, 24 Feb 2012 22:39:26 -0000
\r
71 On Fri, 24 Feb 2012 14:47:30 +0400, Dmitry Kurochkin <dmitry.kurochkin@gmail.com> wrote:
\r
72 > On Fri, 24 Feb 2012 00:09:14 +0100, Pieter Praet <pieter@praet.org> wrote:
\r
73 > > * emacs/notmuch-show.el
\r
75 > > (notmuch-show-get-messages-ids):
\r
76 > > New optional argument ONLY-OPEN. If non-nil, only return
\r
77 > > Message-Id's for messages which are currently visible.
\r
79 > > (notmuch-show-tag-all):
\r
80 > > New optional argument IGNORE-VISIBILITY, of which the inverse is
\r
81 > > passed as ONLY-OPEN argument to `notmuch-show-get-messages-ids':
\r
82 > > If called with a prefix arg, affect *all* messages in the current
\r
83 > > buffer. Otherwise, only change tags of visible messages.
\r
85 > > (notmuch-show-archive-thread):
\r
86 > > Update wrt changes to `notmuch-show-tag-all'.
\r
90 > > - Subtest "notmuch-show: change tags of open messages in current buffer"
\r
91 > > is no longer broken.
\r
93 > > emacs/notmuch-show.el | 28 ++++++++++++++++++++--------
\r
94 > > test/emacs | 1 -
\r
95 > > 2 files changed, 20 insertions(+), 9 deletions(-)
\r
97 > > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
\r
98 > > index 4b37c77..4499fcd 100644
\r
99 > > --- a/emacs/notmuch-show.el
\r
100 > > +++ b/emacs/notmuch-show.el
\r
101 > > @@ -1334,13 +1334,17 @@ (defun notmuch-show-get-message-id ()
\r
102 > > "Return the message id of the current message."
\r
103 > > (concat "id:\"" (notmuch-show-get-prop :id) "\""))
\r
105 > > -(defun notmuch-show-get-messages-ids (&optional separator)
\r
106 > > +(defun notmuch-show-get-messages-ids (&optional only-open separator)
\r
107 > > "Return a list of Message-Id's of all messages in the current buffer.
\r
109 > > +If optional argument ONLY-OPEN is non-nil, only return
\r
110 > > +Message-Id's for messages which are currently visible.
\r
112 > > If provided with optional argument SEPARATOR, return a string
\r
113 > > instead, consisting of all Message-Id's separated by SEPARATOR."
\r
114 > > (let ((message-ids))
\r
115 > > - (notmuch-show-mapc t
\r
116 > > + (notmuch-show-mapc
\r
117 > > + `(if only-open (notmuch-show-message-visible-p) t)
\r
119 > How about changing ONLY-OPEN to a general optional PREDICATE argument
\r
120 > 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
171 > > --- a/test/emacs
\r
172 > > +++ b/test/emacs
\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