1 Return-Path: <five9a2@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 BD173431FBC
\r
6 for <notmuch@notmuchmail.org>; Sun, 22 Nov 2009 12:12:07 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
8 Received: from olra.theworths.org ([127.0.0.1])
\r
9 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
10 with ESMTP id k6pCVMZsbV1Y for <notmuch@notmuchmail.org>;
\r
11 Sun, 22 Nov 2009 12:12:07 -0800 (PST)
\r
12 Received: from mail-bw0-f224.google.com (mail-bw0-f224.google.com
\r
14 by olra.theworths.org (Postfix) with ESMTP id E64D2431FAE
\r
15 for <notmuch@notmuchmail.org>; Sun, 22 Nov 2009 12:12:06 -0800 (PST)
\r
16 Received: by bwz24 with SMTP id 24so3485864bwz.30
\r
17 for <notmuch@notmuchmail.org>; Sun, 22 Nov 2009 12:12:06 -0800 (PST)
\r
18 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
\r
19 h=domainkey-signature:received:received:sender:from:to:cc:subject
\r
20 :date:message-id:x-mailer;
\r
21 bh=Zks5lvj6FulQ71zLxZ8ec62bCqVfNS8Wm0ku2SDDnbk=;
\r
22 b=OBoGgorNZMjmQA7CuheeH/UhCsYV739+jAW031mVOpLZj8trJIpgPOsdF6Oh+gEJlR
\r
23 NGnP8ZO2IzaNUwIZTBubr4b1oTWfh4LGxZatmoV2tcsaA+ur8EdJGlARr1/YY5HNqRfl
\r
24 eEreHLCdkUlS/I/rjCJUjC/8S5/YZjqoNXO+o=
\r
25 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
\r
26 h=sender:from:to:cc:subject:date:message-id:x-mailer;
\r
27 b=iT2BDU8BI5ZaLFYl2U9FXj/CJ/YfaVT0Tj/H5zNRBDqq9a+nF+onHKjS9AuFscu8vU
\r
28 K2NtI4c+YHt9c4l4qSKT3faThDHmydROm7+jN1aFhnGWarOC3oL9td7uy907CY67mBCa
\r
29 /Plue/jRQk0pLfquU+0sBxdJxfO/Rvjjb4ZjQ=
\r
30 Received: by 10.204.13.207 with SMTP id d15mr2776921bka.157.1258920726066;
\r
31 Sun, 22 Nov 2009 12:12:06 -0800 (PST)
\r
32 Received: from localhost.localdomain (vawpc43.ethz.ch [129.132.59.11])
\r
33 by mx.google.com with ESMTPS id 21sm4687387fkx.25.2009.11.22.12.12.04
\r
34 (version=TLSv1/SSLv3 cipher=RC4-MD5);
\r
35 Sun, 22 Nov 2009 12:12:05 -0800 (PST)
\r
36 Sender: Jed Brown <five9a2@gmail.com>
\r
37 From: Jed Brown <jed@59A2.org>
\r
38 To: notmuch@notmuchmail.org
\r
39 Date: Sun, 22 Nov 2009 21:12:16 +0100
\r
40 Message-Id: <1258920736-14205-1-git-send-email-jed@59A2.org>
\r
41 X-Mailer: git-send-email 1.6.5.3
\r
42 Subject: [notmuch] [PATCH] New function notmuch-search-operate-all: operate
\r
43 on all messages in the current query.
\r
44 X-BeenThere: notmuch@notmuchmail.org
\r
45 X-Mailman-Version: 2.1.12
\r
47 List-Id: "Use and development of the notmuch mail system."
\r
48 <notmuch.notmuchmail.org>
\r
49 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
50 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
51 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
52 List-Post: <mailto:notmuch@notmuchmail.org>
\r
53 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
54 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
55 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
56 X-List-Received-Date: Sun, 22 Nov 2009 20:12:07 -0000
\r
58 It is often convenient to change tags on several messages at once. This
\r
59 function applies any number of tag whitespace-delimited tag
\r
60 modifications to all messages matching the current query.
\r
62 I have bound this to `*'.
\r
64 Signed-off-by: Jed Brown <jed@59A2.org>
\r
66 notmuch.el | 24 ++++++++++++++++++++++++
\r
67 1 files changed, 24 insertions(+), 0 deletions(-)
\r
69 diff --git a/notmuch.el b/notmuch.el
\r
70 index a547415..b848e9a 100644
\r
73 @@ -764,6 +764,7 @@ thread from that buffer can be show when done with this one)."
\r
74 (define-key map (kbd "RET") 'notmuch-search-show-thread)
\r
75 (define-key map "+" 'notmuch-search-add-tag)
\r
76 (define-key map "-" 'notmuch-search-remove-tag)
\r
77 + (define-key map "*" 'notmuch-search-operate-all)
\r
78 (define-key map "<" 'beginning-of-buffer)
\r
79 (define-key map ">" 'notmuch-search-goto-last-thread)
\r
80 (define-key map "=" 'notmuch-search-refresh-view)
\r
81 @@ -940,6 +941,29 @@ This function advances point to the next line when finished."
\r
82 (notmuch-search-remove-tag "inbox")
\r
85 +(defun notmuch-search-operate-all (action)
\r
86 + "Operate on all messages matching the current query. Any
\r
87 +number of whitespace separated actions can be given. Each action
\r
88 +must have one of the two forms
\r
90 + +tagname Add the tag `tagname'
\r
91 + -tagname Remove the tag `tagname'
\r
93 +Each character of the tag name may consist of alphanumeric
\r
94 +characters as well as `_.+-'.
\r
96 + (interactive "sOperation (+add -drop): notmuch tag ")
\r
97 + (let ((action-split (split-string action " +")))
\r
98 + ;; Perform some validation
\r
99 + (let ((words action-split))
\r
100 + (when (null words) (error "No operation given"))
\r
102 + (unless (string-match-p "^[\+\-][_\+\-\\w]+$" (car words))
\r
103 + (error "Action must be of the form `+thistag -that_tag'"))
\r
104 + (setq words (cdr words))))
\r
105 + (apply 'notmuch-call-notmuch-process "tag"
\r
106 + (append action-split (list notmuch-search-query-string) nil))))
\r
108 (defun notmuch-search (query &optional oldest-first)
\r
109 "Run \"notmuch search\" with the given query string and display results."
\r
110 (interactive "sNotmuch search: ")
\r