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 AA76A431FC2
\r
6 for <notmuch@notmuchmail.org>; Thu, 23 Feb 2012 15:11:48 -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 jKwdCtQ+UJI0 for <notmuch@notmuchmail.org>;
\r
16 Thu, 23 Feb 2012 15:11:47 -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 58D3B431FD0
\r
21 for <notmuch@notmuchmail.org>; Thu, 23 Feb 2012 15:11:42 -0800 (PST)
\r
22 Received: by mail-wi0-f181.google.com with SMTP id hi8so1241599wib.26
\r
23 for <notmuch@notmuchmail.org>; Thu, 23 Feb 2012 15:11:42 -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 ea2mr725463wib.20.1330038702050 (num_hops
\r
32 = 1); Thu, 23 Feb 2012 15:11:42 -0800 (PST)
\r
34 Received: by 10.180.97.130 with SMTP id ea2mr588444wib.20.1330038701972;
\r
35 Thu, 23 Feb 2012 15:11:41 -0800 (PST)
\r
36 Received: from localhost ([109.131.181.26])
\r
37 by mx.google.com with ESMTPS id cs4sm13259086wib.8.2012.02.23.15.11.41
\r
38 (version=TLSv1/SSLv3 cipher=OTHER);
\r
39 Thu, 23 Feb 2012 15:11:41 -0800 (PST)
\r
40 From: Pieter Praet <pieter@praet.org>
\r
41 To: David Bremner <david@tethera.net>,
\r
42 Dmitry Kurochkin <dmitry.kurochkin@gmail.com>
\r
43 Subject: [PATCH 6/6] emacs: `notmuch-show-tag-all' sans prefix arg only tags
\r
45 Date: Fri, 24 Feb 2012 00:09:14 +0100
\r
46 Message-Id: <1330038554-10347-6-git-send-email-pieter@praet.org>
\r
47 X-Mailer: git-send-email 1.7.8.1
\r
48 In-Reply-To: <878vjtqhcg.fsf@praet.org>
\r
49 References: <878vjtqhcg.fsf@praet.org>
\r
51 ALoCoQnfKAtgFKsq0/uQ2vpW+bYcdLp7D71XKJ/ByMXGv7IoPqtqF2VgBaPxtUUHDBDnF45XKvFa
\r
52 Cc: Notmuch Mail <notmuch@notmuchmail.org>
\r
53 X-BeenThere: notmuch@notmuchmail.org
\r
54 X-Mailman-Version: 2.1.13
\r
56 List-Id: "Use and development of the notmuch mail system."
\r
57 <notmuch.notmuchmail.org>
\r
58 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
59 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
60 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
61 List-Post: <mailto:notmuch@notmuchmail.org>
\r
62 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
63 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
64 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
65 X-List-Received-Date: Thu, 23 Feb 2012 23:11:49 -0000
\r
67 * emacs/notmuch-show.el
\r
69 (notmuch-show-get-messages-ids):
\r
70 New optional argument ONLY-OPEN. If non-nil, only return
\r
71 Message-Id's for messages which are currently visible.
\r
73 (notmuch-show-tag-all):
\r
74 New optional argument IGNORE-VISIBILITY, of which the inverse is
\r
75 passed as ONLY-OPEN argument to `notmuch-show-get-messages-ids':
\r
76 If called with a prefix arg, affect *all* messages in the current
\r
77 buffer. Otherwise, only change tags of visible messages.
\r
79 (notmuch-show-archive-thread):
\r
80 Update wrt changes to `notmuch-show-tag-all'.
\r
84 - Subtest "notmuch-show: change tags of open messages in current buffer"
\r
85 is no longer broken.
\r
87 emacs/notmuch-show.el | 28 ++++++++++++++++++++--------
\r
89 2 files changed, 20 insertions(+), 9 deletions(-)
\r
91 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
\r
92 index 4b37c77..4499fcd 100644
\r
93 --- a/emacs/notmuch-show.el
\r
94 +++ b/emacs/notmuch-show.el
\r
95 @@ -1334,13 +1334,17 @@ (defun notmuch-show-get-message-id ()
\r
96 "Return the message id of the current message."
\r
97 (concat "id:\"" (notmuch-show-get-prop :id) "\""))
\r
99 -(defun notmuch-show-get-messages-ids (&optional separator)
\r
100 +(defun notmuch-show-get-messages-ids (&optional only-open separator)
\r
101 "Return a list of Message-Id's of all messages in the current buffer.
\r
103 +If optional argument ONLY-OPEN is non-nil, only return
\r
104 +Message-Id's for messages which are currently visible.
\r
106 If provided with optional argument SEPARATOR, return a string
\r
107 instead, consisting of all Message-Id's separated by SEPARATOR."
\r
108 (let ((message-ids))
\r
109 - (notmuch-show-mapc t
\r
110 + (notmuch-show-mapc
\r
111 + `(if only-open (notmuch-show-message-visible-p) t)
\r
112 (lambda () (push (notmuch-show-get-message-id) message-ids)))
\r
114 (mapconcat 'identity message-ids separator)
\r
115 @@ -1628,13 +1632,21 @@ (defun notmuch-show-tag (&optional initial-input)
\r
116 initial-input (notmuch-show-get-message-id))))
\r
117 (apply 'notmuch-show-tag-message tag-changes)))
\r
119 -(defun notmuch-show-tag-all (&rest tag-changes)
\r
120 - "Change tags for all messages in the current thread.
\r
121 +(defun notmuch-show-tag-all (&optional ignore-visibility &rest tag-changes)
\r
122 + "Change tags of all open messages in the current buffer.
\r
124 +If optional arg IGNORE-VISIBILITY is non-nil, change tags of
\r
125 +*all* messages in the current buffer, independent of their
\r
128 TAG-CHANGES is a list of tag operations for `notmuch-tag'."
\r
129 - (interactive (notmuch-read-tag-changes nil notmuch-show-thread-id))
\r
130 - (apply 'notmuch-tag (notmuch-show-get-messages-ids " or ") tag-changes)
\r
131 - (notmuch-show-mapc t
\r
132 + (interactive (cons current-prefix-arg
\r
133 + (notmuch-read-tag-changes nil notmuch-show-thread-id)))
\r
134 + (apply 'notmuch-tag
\r
135 + (notmuch-show-get-messages-ids (not ignore-visibility) " or ")
\r
137 + (notmuch-show-mapc
\r
138 + `(if ignore-visibility t (notmuch-show-message-visible-p))
\r
140 (let* ((current-tags (notmuch-show-get-tags))
\r
141 (new-tags (notmuch-update-tags current-tags tag-changes)))
\r
142 @@ -1719,7 +1731,7 @@ (defun notmuch-show-archive-thread (&optional unarchive)
\r
145 (let ((op (if unarchive "+" "-")))
\r
146 - (notmuch-show-tag-all (concat op "inbox"))))
\r
147 + (notmuch-show-tag-all t (concat op "inbox"))))
\r
149 (defun notmuch-show-archive-thread-then-next ()
\r
150 "Archive each message in thread, then show next thread from search."
\r
151 diff --git a/test/emacs b/test/emacs
\r
152 index 644ef59..c286ff5 100755
\r
155 @@ -152,7 +152,6 @@ notmuch tag +"$del_tag" -"$add_tag" -- "$query" # revert tag changes
\r
156 test_expect_equal "$count_changed" "$count_total" # assert that CHANGED == TOTAL
\r
158 test_begin_subtest "notmuch-show: change tags of open messages in current buffer"
\r
159 -test_subtest_known_broken
\r
160 query="$os_x_darwin_thread"
\r
161 filter="from:Jiang"
\r
162 add_tag="notmuch-show-tag-all"
\r