Re: Flat search and threaded views
[notmuch-archives.git] / 3f / ceb4d2d844164d154cd0b4dec5ef27962aad09
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 88882431FC0\r
6         for <notmuch@notmuchmail.org>; Thu, 26 Nov 2009 13:36:19 -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 AveR7evhbl0p for <notmuch@notmuchmail.org>;\r
11         Thu, 26 Nov 2009 13:36:18 -0800 (PST)\r
12 Received: from mail-bw0-f224.google.com (mail-bw0-f224.google.com\r
13         [209.85.218.224])\r
14         by olra.theworths.org (Postfix) with ESMTP id 5D35F431FAE\r
15         for <notmuch@notmuchmail.org>; Thu, 26 Nov 2009 13:36:18 -0800 (PST)\r
16 Received: by bwz24 with SMTP id 24so847011bwz.30\r
17         for <notmuch@notmuchmail.org>; Thu, 26 Nov 2009 13:36:17 -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:in-reply-to:references;\r
21         bh=oCvftKjZw1bsgGzpI8mjNWcx/O904TObO3Ha1UyPHCk=;\r
22         b=UBYmXrv/hpXuzRHBDvs1skcfZB1CBWer1ukr/R5FP7MzB4YuqeyojGrS5sR1HC3I/d\r
23         8erNMdtet5gCINdja2GHhsXCg2pDDRrUsVAWEbPuUAzJuQoHnmo0j6te3kh0dU9jspXy\r
24         nRFLyPpwpEgye2Z9OkE3NFcoTA1IJ1ZjcrjP0=\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:in-reply-to\r
27         :references;\r
28         b=tefcvDKDnI6dX3FivROryEFoLadNaJjRdNd5r/7hK9BeORqhNsw5I12fEdfzpq4T7z\r
29         1UHG4HKGosh3dNkc6BMxOoFkcA3gqLRLfCkxBPfLj04nxcJf1XSbzgkGtEJWSzlklpk1\r
30         FTWn3P11g/I0A43NAj3YmUQHsKRUpaGmR719k=\r
31 Received: by 10.204.153.27 with SMTP id i27mr234492bkw.155.1259271377642;\r
32         Thu, 26 Nov 2009 13:36:17 -0800 (PST)\r
33 Received: from localhost.localdomain (vawpc43.ethz.ch [129.132.59.11])\r
34         by mx.google.com with ESMTPS id p9sm1421100fkb.14.2009.11.26.13.36.15\r
35         (version=TLSv1/SSLv3 cipher=RC4-MD5);\r
36         Thu, 26 Nov 2009 13:36:16 -0800 (PST)\r
37 Sender: Jed Brown <five9a2@gmail.com>\r
38 From: Jed Brown <jed@59A2.org>\r
39 To: cworth@cworth.org\r
40 Date: Thu, 26 Nov 2009 22:36:49 +0100\r
41 Message-Id: <1259271410-15336-1-git-send-email-jed@59A2.org>\r
42 X-Mailer: git-send-email 1.6.5.3\r
43 In-Reply-To: <87pr75q9va.fsf@yoom.home.cworth.org>\r
44 References: <87pr75q9va.fsf@yoom.home.cworth.org>\r
45 Cc: notmuch@notmuchmail.org\r
46 Subject: [notmuch] [PATCH 1/2] New function notmuch-search-operate-all:\r
47         operate on all messages in the current query.\r
48 X-BeenThere: notmuch@notmuchmail.org\r
49 X-Mailman-Version: 2.1.12\r
50 Precedence: list\r
51 List-Id: "Use and development of the notmuch mail system."\r
52         <notmuch.notmuchmail.org>\r
53 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
54         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
55 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
56 List-Post: <mailto:notmuch@notmuchmail.org>\r
57 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
58 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
59         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
60 X-List-Received-Date: Thu, 26 Nov 2009 21:36:19 -0000\r
61 \r
62 It is often convenient to change tags on several messages at once.  This\r
63 function applies any number of tag whitespace-delimited tag\r
64 modifications to all messages matching the current query.\r
65 \r
66 I have bound this to `*'.\r
67 \r
68 Signed-off-by: Jed Brown <jed@59A2.org>\r
69 ---\r
70  notmuch.el |   24 ++++++++++++++++++++++++\r
71  1 files changed, 24 insertions(+), 0 deletions(-)\r
72 \r
73 diff --git a/notmuch.el b/notmuch.el\r
74 index d7c973c..6adac9e 100644\r
75 --- a/notmuch.el\r
76 +++ b/notmuch.el\r
77 @@ -801,6 +801,7 @@ thread from that buffer can be show when done with this one)."\r
78      (define-key map [mouse-1] 'notmuch-search-show-thread)\r
79      (define-key map "+" 'notmuch-search-add-tag)\r
80      (define-key map "-" 'notmuch-search-remove-tag)\r
81 +    (define-key map "*" 'notmuch-search-operate-all)\r
82      (define-key map "<" 'beginning-of-buffer)\r
83      (define-key map ">" 'notmuch-search-goto-last-thread)\r
84      (define-key map "=" 'notmuch-search-refresh-view)\r
85 @@ -1001,6 +1002,29 @@ This function advances point to the next line when finished."\r
86                   (set 'more nil))))))\r
87        (delete-process proc))))\r
88  \r
89 +(defun notmuch-search-operate-all (action)\r
90 +  "Operate on all messages matching the current query.  Any\r
91 +number of whitespace separated actions can be given.  Each action\r
92 +must have one of the two forms\r
93 +\r
94 +  +tagname              Add the tag `tagname'\r
95 +  -tagname              Remove the tag `tagname'\r
96 +\r
97 +Each character of the tag name may consist of alphanumeric\r
98 +characters as well as `_.+-'.\r
99 +"\r
100 +  (interactive "sOperation (+add -drop): notmuch tag ")\r
101 +  (let ((action-split (split-string action " +")))\r
102 +    ;; Perform some validation\r
103 +    (let ((words action-split))\r
104 +      (when (null words) (error "No operation given"))\r
105 +      (while words\r
106 +       (unless (string-match-p "^[\+\-][_\+\-\\w]+$" (car words))\r
107 +         (error "Action must be of the form `+thistag -that_tag'"))\r
108 +       (setq words (cdr words))))\r
109 +    (apply 'notmuch-call-notmuch-process "tag"\r
110 +          (append action-split (list notmuch-search-query-string) nil))))\r
111 +\r
112  (defun notmuch-search (query &optional oldest-first)\r
113    "Run \"notmuch search\" with the given query string and display results."\r
114    (interactive "sNotmuch search: ")\r
115 -- \r
116 1.6.5.3\r
117 \r