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 DED64431FAE
\r
6 for <notmuch@notmuchmail.org>; Wed, 2 Dec 2009 03:00:08 -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 06zMPaBY8vLU for <notmuch@notmuchmail.org>;
\r
11 Wed, 2 Dec 2009 03:00:08 -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 87611431FBC
\r
15 for <notmuch@notmuchmail.org>; Wed, 2 Dec 2009 03:00:08 -0800 (PST)
\r
16 Received: by bwz24 with SMTP id 24so58174bwz.30
\r
17 for <notmuch@notmuchmail.org>; Wed, 02 Dec 2009 03:00: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:in-reply-to:references;
\r
21 bh=0AcfGDF0GFZRvMFHx+Tn5LmvY9dZr6hOkIKkwuFeXNI=;
\r
22 b=pvGRi30RFhv+Dk0IQb5kN7VnlZk2cNqPyo6LVal62jPNGBC+DJJubJxUxxErLlctCA
\r
23 Mrm+rPiIHVIkcWfcfDsxumsMSEgdP4VnYVC5Q0WXKUbHvQudLPA7bkLEWASez9B9yYLG
\r
24 QV1OPoL92IlnRmGQ64Nn7hKEeMlzEAs3C8dOM=
\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
28 b=kHkCUeDJ2X/jH0/dnsf7SLeHrhV7xJ1AAmAGMWyiIcIbyLqMOWwFmEfNsvC9f1sLum
\r
29 ZZDEKcUnySEG2eJxPkRPaHnuOm+A2MtRFG02tVbwTmBPBoXzpv6Xz0vxmtEcnTbXnHEz
\r
30 9Zc5J0HxGLKO9F2RB8F7mtUrYCzS5I2o/avRg=
\r
31 Received: by 10.204.151.194 with SMTP id d2mr3831764bkw.85.1259751606703;
\r
32 Wed, 02 Dec 2009 03:00:06 -0800 (PST)
\r
33 Received: from localhost.localdomain (vawpc43.ethz.ch [129.132.59.11])
\r
34 by mx.google.com with ESMTPS id 21sm1280205fkx.25.2009.12.02.03.00.04
\r
35 (version=TLSv1/SSLv3 cipher=RC4-MD5);
\r
36 Wed, 02 Dec 2009 03:00:05 -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: Wed, 2 Dec 2009 12:00:35 +0100
\r
41 Message-Id: <1259751635-7496-1-git-send-email-jed@59A2.org>
\r
42 X-Mailer: git-send-email 1.6.5.3
\r
43 In-Reply-To: <87vdgp4p5e.fsf@59A2.org>
\r
44 References: <87vdgp4p5e.fsf@59A2.org>
\r
45 Cc: notmuch@notmuchmail.org
\r
46 Subject: [notmuch] [PATCH] Make search filters handle disjunctive queries.
\r
47 X-BeenThere: notmuch@notmuchmail.org
\r
48 X-Mailman-Version: 2.1.12
\r
50 List-Id: "Use and development of the notmuch mail system."
\r
51 <notmuch.notmuchmail.org>
\r
52 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
53 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
54 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
55 List-Post: <mailto:notmuch@notmuchmail.org>
\r
56 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
57 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
58 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
59 X-List-Received-Date: Wed, 02 Dec 2009 11:00:09 -0000
\r
61 notmuch-search-filter now accepts an arbitrary query and will group if
\r
62 necessary so that we get
\r
64 tag:inbox AND (gravy OR biscuits)
\r
66 instead of the former
\r
68 tag:inbox AND gravy OR biscuits
\r
70 Signed-off-by: Jed Brown <jed@59A2.org>
\r
72 notmuch.el | 5 ++++-
\r
73 1 files changed, 4 insertions(+), 1 deletions(-)
\r
75 diff --git a/notmuch.el b/notmuch.el
\r
76 index 2509651..0bf82f5 100644
\r
79 @@ -995,6 +995,8 @@ thread from that buffer can be show when done with this one)."
\r
80 (defvar notmuch-search-oldest-first t
\r
81 "Show the oldest mail first in the search-mode")
\r
83 +(defvar notmuch-search-disjunctive-regexp "\\<[oO][rR]\\>")
\r
85 (defun notmuch-search-scroll-up ()
\r
86 "Move forward through search results by one window's worth."
\r
88 @@ -1327,7 +1329,8 @@ search."
\r
89 Runs a new search matching only messages that match both the
\r
90 current search results AND the additional query string provided."
\r
91 (interactive "sFilter search: ")
\r
92 - (notmuch-search (concat notmuch-search-query-string " and " query) notmuch-search-oldest-first))
\r
93 + (let ((grouped-query (if (string-match-p notmuch-search-disjunctive-regexp query) (concat "( " query " )") query)))
\r
94 + (notmuch-search (concat notmuch-search-query-string " and " grouped-query) notmuch-search-oldest-first)))
\r
96 (defun notmuch-search-filter-by-tag (tag)
\r
97 "Filter the current search results based on a single tag.
\r