1 Return-Path: <jeremy@nickurak.ca>
\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 34D0F431FBC
\r
6 for <notmuch@notmuchmail.org>; Sat, 28 Jan 2012 08:49:37 -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=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_LOW=-0.7]
\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 albkhuaxi1vt for <notmuch@notmuchmail.org>;
\r
17 Sat, 28 Jan 2012 08:49:35 -0800 (PST)
\r
18 Received: from mail-qy0-f181.google.com (mail-qy0-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 9AE26431FAE
\r
22 for <notmuch@notmuchmail.org>; Sat, 28 Jan 2012 08:49:35 -0800 (PST)
\r
23 Received: by qcpx40 with SMTP id x40so1767495qcp.26
\r
24 for <notmuch@notmuchmail.org>; Sat, 28 Jan 2012 08:49:34 -0800 (PST)
\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
\r
26 d=nickurak.ca; s=google-dkim;
\r
27 h=mime-version:sender:x-originating-ip:in-reply-to:references:date
\r
28 :x-google-sender-auth:message-id:subject:from:to:cc:content-type
\r
29 :content-transfer-encoding;
\r
30 bh=LLshUyKd/l/DsQCeTB9H4gQbGM9vX1XCWio68YUjJ78=;
\r
31 b=FZHZdgsuja8a9yeLLVzPIOtzqJG6ef8U3AsSzriP1caruNmpXcnoZWcm7cjUJVoMaU
\r
32 Lxnyw3MkOb8wdglm+FhykMaHstxCYPTxsFnJZxUcyRMuRWTkzjSdfVxmtmNr73jmzRaY
\r
33 ST+v909sCuAY+izIJoiEBWDjOkuqls+fT0xz0=
\r
35 Received: by 10.224.193.66 with SMTP id dt2mr14127747qab.92.1327769373917;
\r
36 Sat, 28 Jan 2012 08:49:33 -0800 (PST)
\r
37 Sender: jeremy@nickurak.ca
\r
38 Received: by 10.229.40.149 with HTTP; Sat, 28 Jan 2012 08:49:33 -0800 (PST)
\r
39 X-Originating-IP: [68.148.28.35]
\r
40 In-Reply-To: <1327725684-5887-3-git-send-email-dmitry.kurochkin@gmail.com>
\r
41 References: <1327725684-5887-1-git-send-email-dmitry.kurochkin@gmail.com>
\r
42 <1327725684-5887-3-git-send-email-dmitry.kurochkin@gmail.com>
\r
43 Date: Sat, 28 Jan 2012 09:49:33 -0700
\r
44 X-Google-Sender-Auth: OSeSH6EVx_Xvqi41HewaQa8PWVM
\r
46 <CA+eQo_0Ddb89pRELBsXSrrkC69PGGrm9fwYg5YGU8g59LqACvQ@mail.gmail.com>
\r
47 Subject: Re: [PATCH 3/6] emacs: make "+" and "-" tagging operations more
\r
49 From: Jeremy Nickurak <not-much@trk.nickurak.ca>
\r
50 To: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>
\r
51 Content-Type: text/plain; charset=UTF-8
\r
52 Content-Transfer-Encoding: quoted-printable
\r
53 Cc: notmuch@notmuchmail.org
\r
54 X-BeenThere: notmuch@notmuchmail.org
\r
55 X-Mailman-Version: 2.1.13
\r
57 List-Id: "Use and development of the notmuch mail system."
\r
58 <notmuch.notmuchmail.org>
\r
59 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
60 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
61 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
62 List-Post: <mailto:notmuch@notmuchmail.org>
\r
63 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
64 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
65 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
66 X-List-Received-Date: Sat, 28 Jan 2012 16:49:37 -0000
\r
68 Is it safe to assume that any reasonable seperator (comma, space,
\r
69 semicolon, plus or minus sign, anything) won't show up in a tag name?
\r
71 On Fri, Jan 27, 2012 at 21:41, Dmitry Kurochkin
\r
72 <dmitry.kurochkin@gmail.com> wrote:
\r
73 > Before the change, "+" and "-" tagging operations in notmuch-search
\r
74 > and notmuch-show views accepted only a single tag. =C2=A0The patch makes
\r
75 > them use the recently added `notmuch-select-tags-with-completion'
\r
76 > function, which allows to enter multiple tags with "+" and "-"
\r
77 > prefixes. =C2=A0So after the change, "+" and "-" bindings allow to both a=
\r
79 > and remove multiple tags. =C2=A0The only difference between "+" and "-" i=
\r
81 > the minibuffer initial input ("+" and "-" respectively).
\r
83 > =C2=A0emacs/notmuch-show.el | =C2=A0 65 +++++++------------
\r
84 > =C2=A0emacs/notmuch.el =C2=A0 =C2=A0 =C2=A0| =C2=A0165 ++++++++++++++++++=
\r
85 +++++++------------------------
\r
86 > =C2=A02 files changed, 107 insertions(+), 123 deletions(-)
\r
88 > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
\r
89 > index 84ac624..03eadfb 100644
\r
90 > --- a/emacs/notmuch-show.el
\r
91 > +++ b/emacs/notmuch-show.el
\r
94 > =C2=A0(declare-function notmuch-call-notmuch-process "notmuch" (&rest arg=
\r
96 > =C2=A0(declare-function notmuch-fontify-headers "notmuch" nil)
\r
97 > -(declare-function notmuch-select-tag-with-completion "notmuch" (prompt &=
\r
99 > +(declare-function notmuch-select-tags-with-completion "notmuch" (&option=
\r
100 al initial-input &rest search-terms))
\r
101 > =C2=A0(declare-function notmuch-search-show-thread "notmuch" nil)
\r
102 > +(declare-function notmuch-update-tags "notmuch" (current-tags changed-ta=
\r
105 > =C2=A0(defcustom notmuch-message-headers '("Subject" "To" "Cc" "Date")
\r
106 > =C2=A0 "Headers that should be shown in a message, in this order.
\r
107 > @@ -1267,7 +1268,7 @@ Some useful entries are:
\r
109 > =C2=A0(defun notmuch-show-mark-read ()
\r
110 > =C2=A0 "Mark the current message as read."
\r
111 > - =C2=A0(notmuch-show-remove-tag "unread"))
\r
112 > + =C2=A0(notmuch-show-tag-message "-unread"))
\r
114 > =C2=A0;; Functions for getting attributes of several messages in the curr=
\r
117 > @@ -1470,51 +1471,33 @@ than only the current message."
\r
118 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(message (format "Command '%s' e=
\r
119 xited abnormally with code %d"
\r
120 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
\r
121 =A0 =C2=A0 =C2=A0 =C2=A0 shell-command exit-code))))))))
\r
123 > -(defun notmuch-show-add-tags-worker (current-tags add-tags)
\r
124 > - =C2=A0"Add to `current-tags' with any tags from `add-tags' not
\r
125 > -currently present and return the result."
\r
126 > - =C2=A0(let ((result-tags (copy-sequence current-tags)))
\r
127 > - =C2=A0 =C2=A0(mapc (lambda (add-tag)
\r
128 > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (unless (member add-tag current-tags=
\r
130 > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (setq result-tags (push add-t=
\r
132 > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 add-tags)
\r
133 > - =C2=A0 =C2=A0(sort result-tags 'string<)))
\r
135 > -(defun notmuch-show-del-tags-worker (current-tags del-tags)
\r
136 > - =C2=A0"Remove any tags in `del-tags' from `current-tags' and return
\r
138 > - =C2=A0(let ((result-tags (copy-sequence current-tags)))
\r
139 > - =C2=A0 =C2=A0(mapc (lambda (del-tag)
\r
140 > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (setq result-tags (delete del-tag re=
\r
142 > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 del-tags)
\r
143 > - =C2=A0 =C2=A0result-tags))
\r
145 > -(defun notmuch-show-add-tag (&rest toadd)
\r
146 > - =C2=A0"Add a tag to the current message."
\r
147 > - =C2=A0(interactive
\r
148 > - =C2=A0 (list (notmuch-select-tag-with-completion "Tag to add: ")))
\r
149 > +(defun notmuch-show-tag-message (&rest changed-tags)
\r
150 > + =C2=A0"Change tags for the current message.
\r
152 > +`Changed-tags' is a list of tag operations for \"notmuch tag\",
\r
153 > +i.e. a list of tags to change with '+' and '-' prefixes."
\r
154 > =C2=A0 (let* ((current-tags (notmuch-show-get-tags))
\r
155 > - =C2=A0 =C2=A0 =C2=A0 =C2=A0(new-tags (notmuch-show-add-tags-worker curr=
\r
158 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0(new-tags (notmuch-update-tags current-tags =
\r
160 > =C2=A0 =C2=A0 (unless (equal current-tags new-tags)
\r
161 > - =C2=A0 =C2=A0 =C2=A0(apply 'notmuch-tag (notmuch-show-get-message-id)
\r
162 > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(mapcar (lambda (s) (concat "+=
\r
164 > + =C2=A0 =C2=A0 =C2=A0(apply 'notmuch-tag (notmuch-show-get-message-id) c=
\r
166 > =C2=A0 =C2=A0 =C2=A0 (notmuch-show-set-tags new-tags))))
\r
168 > -(defun notmuch-show-remove-tag (&rest toremove)
\r
169 > - =C2=A0"Remove a tag from the current message."
\r
170 > - =C2=A0(interactive
\r
171 > - =C2=A0 (list (notmuch-select-tag-with-completion
\r
172 > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 "Tag to remove: " (notmuch-show-get-message=
\r
174 > +(defun notmuch-show-tag (&optional initial-input)
\r
175 > + =C2=A0"Change tags for the current message, read input from the minibuf=
\r
177 > + =C2=A0(interactive)
\r
178 > + =C2=A0(let ((changed-tags (notmuch-select-tags-with-completion
\r
179 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
\r
180 =C2=A0initial-input (notmuch-show-get-message-id))))
\r
181 > + =C2=A0 =C2=A0(apply 'notmuch-show-tag-message changed-tags)))
\r
183 > - =C2=A0(let* ((current-tags (notmuch-show-get-tags))
\r
184 > - =C2=A0 =C2=A0 =C2=A0 =C2=A0(new-tags (notmuch-show-del-tags-worker curr=
\r
185 ent-tags toremove)))
\r
186 > +(defun notmuch-show-add-tag ()
\r
187 > + =C2=A0"Same as `notmuch-show-tag' but sets initial input to '+'."
\r
188 > + =C2=A0(interactive)
\r
189 > + =C2=A0(notmuch-show-tag "+"))
\r
191 > - =C2=A0 =C2=A0(unless (equal current-tags new-tags)
\r
192 > - =C2=A0 =C2=A0 =C2=A0(apply 'notmuch-tag (notmuch-show-get-message-id)
\r
193 > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(mapcar (lambda (s) (concat "-=
\r
195 > - =C2=A0 =C2=A0 =C2=A0(notmuch-show-set-tags new-tags))))
\r
196 > +(defun notmuch-show-remove-tag ()
\r
197 > + =C2=A0"Same as `notmuch-show-tag' but sets initial input to '-'."
\r
198 > + =C2=A0(interactive)
\r
199 > + =C2=A0(notmuch-show-tag "-"))
\r
201 > =C2=A0(defun notmuch-show-toggle-headers ()
\r
202 > =C2=A0 "Toggle the visibility of the current message headers."
\r
203 > @@ -1559,7 +1542,7 @@ argument, hide all of the messages."
\r
204 > =C2=A0(defun notmuch-show-archive-thread-internal (show-next)
\r
205 > =C2=A0 ;; Remove the tag from the current set of messages.
\r
206 > =C2=A0 (goto-char (point-min))
\r
207 > - =C2=A0(loop do (notmuch-show-remove-tag "inbox")
\r
208 > + =C2=A0(loop do (notmuch-show-tag-message "-inbox")
\r
209 > =C2=A0 =C2=A0 =C2=A0 =C2=A0until (not (notmuch-show-goto-message-next)))
\r
210 > =C2=A0 ;; Move to the next item in the search results, if any.
\r
211 > =C2=A0 (let ((parent-buffer notmuch-show-parent-buffer))
\r
212 > diff --git a/emacs/notmuch.el b/emacs/notmuch.el
\r
213 > index ff46617..24b0ea3 100644
\r
214 > --- a/emacs/notmuch.el
\r
215 > +++ b/emacs/notmuch.el
\r
216 > @@ -76,38 +76,56 @@ For example:
\r
217 > =C2=A0(defvar notmuch-query-history nil
\r
218 > =C2=A0 "Variable to store minibuffer history for notmuch queries")
\r
220 > -(defun notmuch-tag-completions (&optional prefixes search-terms)
\r
221 > - =C2=A0(let ((tag-list
\r
222 > - =C2=A0 =C2=A0 =C2=A0 =C2=A0(split-string
\r
223 > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 (with-output-to-string
\r
224 > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (with-current-buffer standard-output
\r
225 > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (apply 'call-process notmuch-=
\r
227 > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ni=
\r
228 l "search-tags" search-terms)))
\r
229 > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 "\n+" t)))
\r
230 > - =C2=A0 =C2=A0(if (null prefixes)
\r
231 > - =C2=A0 =C2=A0 =C2=A0 tag-list
\r
232 > - =C2=A0 =C2=A0 =C2=A0(apply #'append
\r
233 > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(mapcar (lambda (tag)
\r
234 > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
\r
235 =C2=A0(mapcar (lambda (prefix)
\r
236 > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
\r
237 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(concat prefix tag)) prefixes))
\r
238 > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ta=
\r
240 > +(defun notmuch-tag-completions (&optional search-terms)
\r
241 > + =C2=A0(split-string
\r
242 > + =C2=A0 (with-output-to-string
\r
243 > + =C2=A0 =C2=A0 (with-current-buffer standard-output
\r
244 > + =C2=A0 =C2=A0 =C2=A0 (apply 'call-process notmuch-command nil t
\r
245 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 nil "search-tags" search-term=
\r
247 > + =C2=A0 "\n+" t))
\r
249 > =C2=A0(defun notmuch-select-tag-with-completion (prompt &rest search-term=
\r
251 > - =C2=A0(let ((tag-list (notmuch-tag-completions nil search-terms)))
\r
252 > + =C2=A0(let ((tag-list (notmuch-tag-completions search-terms)))
\r
253 > =C2=A0 =C2=A0 (completing-read prompt tag-list)))
\r
255 > -(defun notmuch-select-tags-with-completion (prompt &optional prefixes &r=
\r
257 > - =C2=A0(let ((tag-list (notmuch-tag-completions prefixes search-terms))
\r
258 > - =C2=A0 =C2=A0 =C2=A0 (crm-separator " ")
\r
259 > - =C2=A0 =C2=A0 =C2=A0 ;; By default, space is bound to "complete word" f=
\r
261 > - =C2=A0 =C2=A0 =C2=A0 ;; Re-bind it to insert a space instead. =C2=A0Not=
\r
263 > - =C2=A0 =C2=A0 =C2=A0 ;; still does the completion.
\r
264 > - =C2=A0 =C2=A0 =C2=A0 (crm-local-completion-map
\r
265 > - =C2=A0 =C2=A0 =C2=A0 =C2=A0(let ((map (make-sparse-keymap)))
\r
266 > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(set-keymap-parent map crm-local-comp=
\r
268 > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(define-key map " " 'self-insert-comm=
\r
270 > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0map)))
\r
271 > - =C2=A0 =C2=A0(delete "" (completing-read-multiple prompt tag-list))))
\r
272 > +(defun notmuch-select-tags-with-completion (&optional initial-input &res=
\r
274 > + =C2=A0(let* ((add-tag-list (mapcar (apply-partially 'concat "+")
\r
275 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
\r
276 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(notmuch-tag-completions)))
\r
277 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0(remove-tag-list (mapcar (apply-partially 'c=
\r
279 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
\r
280 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (notmuch-tag-completions search-t=
\r
282 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0(tag-list (append add-tag-list remove-tag-li=
\r
284 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0(crm-separator " ")
\r
285 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0;; By default, space is bound to "complete w=
\r
287 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0;; Re-bind it to insert a space instead. =C2=
\r
289 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0;; still does the completion.
\r
290 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0(crm-local-completion-map
\r
291 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 (let ((map (make-sparse-keymap)))
\r
292 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (set-keymap-parent map crm-local-com=
\r
294 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (define-key map " " 'self-insert-com=
\r
296 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 map)))
\r
297 > + =C2=A0 =C2=A0(delete "" (completing-read-multiple
\r
298 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "Operations (+add -dro=
\r
299 p): notmuch tag " tag-list nil
\r
300 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 nil initial-input))))
\r
302 > +(defun notmuch-update-tags (current-tags changed-tags)
\r
303 > + =C2=A0"Update `current-tags' with `changed-tags' and return the result.
\r
305 > +`Changed-tags' is a list of tag operations given to \"notmuch
\r
306 > +tag\", i.e. a list of changed tags with '+' and '-' prefixes."
\r
307 > + =C2=A0(let ((result-tags (copy-sequence current-tags)))
\r
308 > + =C2=A0 =C2=A0(mapc (lambda (changed-tag)
\r
309 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (unless (string=3D changed-tag "")
\r
310 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (let ((op (substring changed-=
\r
312 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (tag (su=
\r
313 bstring changed-tag 1)))
\r
314 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (cond ((string=3D op "=
\r
316 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
\r
317 =C2=A0(unless (member tag result-tags)
\r
318 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
\r
319 =C2=A0 =C2=A0(push tag result-tags)))
\r
320 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (=
\r
322 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
\r
323 =C2=A0(setq result-tags (delete tag result-tags)))
\r
324 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (=
\r
326 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
\r
327 =C2=A0(error "Changed tag must be of the form `+this_tag' or `-that_tag'"))=
\r
329 > + =C2=A0 =C2=A0 =C2=A0 changed-tags)
\r
330 > + =C2=A0 =C2=A0(sort result-tags 'string<)))
\r
332 > =C2=A0(defun notmuch-foreach-mime-part (function mm-handle)
\r
333 > =C2=A0 (cond ((stringp (car mm-handle))
\r
334 > @@ -447,6 +465,10 @@ Complete list of currently available key bindings:
\r
335 > =C2=A0 "Return a list of threads for the current region"
\r
336 > =C2=A0 (notmuch-search-properties-in-region 'notmuch-search-thread-id beg=
\r
339 > +(defun notmuch-search-find-thread-id-region-search (beg end)
\r
340 > + =C2=A0"Return a search string for threads for the current region"
\r
341 > + =C2=A0(mapconcat 'identity (notmuch-search-find-thread-id-region beg en=
\r
344 > =C2=A0(defun notmuch-search-find-authors ()
\r
345 > =C2=A0 "Return the authors for the current thread"
\r
346 > =C2=A0 (get-text-property (point) 'notmuch-search-authors))
\r
347 > @@ -590,74 +612,55 @@ the messages that were tagged"
\r
348 > =C2=A0 =C2=A0 =C2=A0 =C2=A0(forward-line 1))
\r
349 > =C2=A0 =C2=A0 =C2=A0 output)))
\r
351 > -(defun notmuch-search-add-tag-thread (tag)
\r
352 > - =C2=A0(notmuch-search-add-tag-region tag (point) (point)))
\r
353 > +(defun notmuch-search-tag-thread (&rest tags)
\r
354 > + =C2=A0"Change tags for the currently selected thread.
\r
356 > -(defun notmuch-search-add-tag-region (tag beg end)
\r
357 > - =C2=A0(let ((search-id-string (mapconcat 'identity (notmuch-search-find=
\r
358 -thread-id-region beg end) " or ")))
\r
359 > - =C2=A0 =C2=A0(notmuch-tag search-id-string (concat "+" tag))
\r
360 > - =C2=A0 =C2=A0(save-excursion
\r
361 > - =C2=A0 =C2=A0 =C2=A0(let ((last-line (line-number-at-pos end))
\r
362 > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (max-line (- (line-number-at-pos (po=
\r
364 > - =C2=A0 =C2=A0 =C2=A0 (goto-char beg)
\r
365 > - =C2=A0 =C2=A0 =C2=A0 (while (<=3D (line-number-at-pos) (min last-line m=
\r
367 > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 (notmuch-search-set-tags (delete-dups (sort=
\r
368 (cons tag (notmuch-search-get-tags)) 'string<)))
\r
369 > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 (forward-line))))))
\r
370 > +See `notmuch-search-tag-region' for details."
\r
371 > + =C2=A0(apply 'notmuch-search-tag-region (point) (point) tags))
\r
373 > -(defun notmuch-search-remove-tag-thread (tag)
\r
374 > - =C2=A0(notmuch-search-remove-tag-region tag (point) (point)))
\r
375 > +(defun notmuch-search-tag-region (beg end &rest tags)
\r
376 > + =C2=A0"Change tags for threads in the given region.
\r
378 > -(defun notmuch-search-remove-tag-region (tag beg end)
\r
379 > - =C2=A0(let ((search-id-string (mapconcat 'identity (notmuch-search-find=
\r
380 -thread-id-region beg end) " or ")))
\r
381 > - =C2=A0 =C2=A0(notmuch-tag search-id-string (concat "-" tag))
\r
382 > +`Tags' is a list of tag operations for \"notmuch tag\", i.e. a
\r
383 > +list of tags to change with '+' and '-' prefixes. =C2=A0The tags are
\r
384 > +added or removed for all threads in the region from `beg' to
\r
386 > + =C2=A0(let ((search-string (notmuch-search-find-thread-id-region-search=
\r
388 > + =C2=A0 =C2=A0(apply 'notmuch-tag search-string tags)
\r
389 > =C2=A0 =C2=A0 (save-excursion
\r
390 > =C2=A0 =C2=A0 =C2=A0 (let ((last-line (line-number-at-pos end))
\r
391 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(max-line (- (line-number-at-pos=
\r
393 > =C2=A0 =C2=A0 =C2=A0 =C2=A0(goto-char beg)
\r
394 > =C2=A0 =C2=A0 =C2=A0 =C2=A0(while (<=3D (line-number-at-pos) (min last-li=
\r
396 > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 (notmuch-search-set-tags (delete tag (notmu=
\r
397 ch-search-get-tags)))
\r
398 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 (notmuch-search-set-tags
\r
399 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(notmuch-update-tags (notmuch-search-=
\r
401 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(forward-line))))))
\r
403 > -(defun notmuch-search-add-tag (tag)
\r
404 > - =C2=A0"Add a tag to the currently selected thread or region.
\r
406 > -The tag is added to all messages in the currently selected thread
\r
407 > -or threads in the current region."
\r
408 > - =C2=A0(interactive
\r
409 > - =C2=A0 (list (notmuch-select-tag-with-completion "Tag to add: ")))
\r
410 > - =C2=A0(save-excursion
\r
411 > - =C2=A0 =C2=A0(if (region-active-p)
\r
412 > - =C2=A0 =C2=A0 =C2=A0 (let* ((beg (region-beginning))
\r
413 > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(end (region-end)))
\r
414 > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 (notmuch-search-add-tag-region tag beg end)=
\r
416 > - =C2=A0 =C2=A0 =C2=A0(notmuch-search-add-tag-thread tag))))
\r
418 > -(defun notmuch-search-remove-tag (tag)
\r
419 > - =C2=A0"Remove a tag from the currently selected thread or region.
\r
420 > +(defun notmuch-search-tag (&optional initial-input)
\r
421 > + =C2=A0"Change tags for the currently selected thread or region."
\r
422 > + =C2=A0(interactive)
\r
423 > + =C2=A0(let* ((beg (if (region-active-p) (region-beginning) (point)))
\r
424 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0(end (if (region-active-p) (region-end) (poi=
\r
426 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0(search-string (notmuch-search-find-thread-i=
\r
427 d-region-search beg end))
\r
428 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0(tags (notmuch-select-tags-with-completion i=
\r
429 nitial-input search-string)))
\r
430 > + =C2=A0 =C2=A0(apply 'notmuch-search-tag-region beg end tags)))
\r
432 > +(defun notmuch-search-add-tag ()
\r
433 > + =C2=A0"Same as `notmuch-search-tag' but sets initial input to '+'."
\r
434 > + =C2=A0(interactive)
\r
435 > + =C2=A0(notmuch-search-tag "+"))
\r
437 > -The tag is removed from all messages in the currently selected
\r
438 > -thread or threads in the current region."
\r
439 > - =C2=A0(interactive
\r
440 > - =C2=A0 (list (notmuch-select-tag-with-completion
\r
441 > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 "Tag to remove: "
\r
442 > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 (if (region-active-p)
\r
443 > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (mapconcat 'identity
\r
444 > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
\r
445 =C2=A0 =C2=A0(notmuch-search-find-thread-id-region (region-beginning) (regi=
\r
447 > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
\r
449 > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (notmuch-search-find-thread-id)))))
\r
450 > - =C2=A0(save-excursion
\r
451 > - =C2=A0 =C2=A0(if (region-active-p)
\r
452 > - =C2=A0 =C2=A0 =C2=A0 (let* ((beg (region-beginning))
\r
453 > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(end (region-end)))
\r
454 > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 (notmuch-search-remove-tag-region tag beg e=
\r
456 > - =C2=A0 =C2=A0 =C2=A0(notmuch-search-remove-tag-thread tag))))
\r
457 > +(defun notmuch-search-remove-tag ()
\r
458 > + =C2=A0"Same as `notmuch-search-tag' but sets initial input to '-'."
\r
459 > + =C2=A0(interactive)
\r
460 > + =C2=A0(notmuch-search-tag "-"))
\r
462 > =C2=A0(defun notmuch-search-archive-thread ()
\r
463 > =C2=A0 "Archive the currently selected thread (remove its \"inbox\" tag).
\r
465 > =C2=A0This function advances the next thread when finished."
\r
466 > =C2=A0 (interactive)
\r
467 > - =C2=A0(notmuch-search-remove-tag-thread "inbox")
\r
468 > + =C2=A0(notmuch-search-tag-thread "-inbox")
\r
469 > =C2=A0 (notmuch-search-next-thread))
\r
471 > =C2=A0(defvar notmuch-search-process-filter-data nil
\r
472 > @@ -893,9 +896,7 @@ will prompt for tags to be added or removed. Tags pre=
\r
474 > =C2=A0Each character of the tag name may consist of alphanumeric
\r
475 > =C2=A0characters as well as `_.+-'.
\r
477 > - =C2=A0(interactive (notmuch-select-tags-with-completion
\r
478 > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "Operations (+add -dro=
\r
480 > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 '("+" "-")))
\r
481 > + =C2=A0(interactive (notmuch-select-tags-with-completion))
\r
482 > =C2=A0 (apply 'notmuch-tag notmuch-search-query-string actions))
\r
484 > =C2=A0(defun notmuch-search-buffer-title (query)
\r
488 > _______________________________________________
\r
489 > notmuch mailing list
\r
490 > notmuch@notmuchmail.org
\r
491 > http://notmuchmail.org/mailman/listinfo/notmuch
\r