[notmuch] [PATCH] Make search filters handle disjunctive queries.
authorJed Brown <jed@59A2.org>
Wed, 2 Dec 2009 11:00:35 +0000 (12:00 +0100)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:35:48 +0000 (09:35 -0800)
22/a4fb15e9cd6c3f34f74b2002fa4b596931f532 [new file with mode: 0644]

diff --git a/22/a4fb15e9cd6c3f34f74b2002fa4b596931f532 b/22/a4fb15e9cd6c3f34f74b2002fa4b596931f532
new file mode 100644 (file)
index 0000000..a1291e6
--- /dev/null
@@ -0,0 +1,100 @@
+Return-Path: <five9a2@gmail.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id DED64431FAE\r
+       for <notmuch@notmuchmail.org>; Wed,  2 Dec 2009 03:00:08 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id 06zMPaBY8vLU for <notmuch@notmuchmail.org>;\r
+       Wed,  2 Dec 2009 03:00:08 -0800 (PST)\r
+Received: from mail-bw0-f224.google.com (mail-bw0-f224.google.com\r
+       [209.85.218.224])\r
+       by olra.theworths.org (Postfix) with ESMTP id 87611431FBC\r
+       for <notmuch@notmuchmail.org>; Wed,  2 Dec 2009 03:00:08 -0800 (PST)\r
+Received: by bwz24 with SMTP id 24so58174bwz.30\r
+       for <notmuch@notmuchmail.org>; Wed, 02 Dec 2009 03:00:06 -0800 (PST)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\r
+       h=domainkey-signature:received:received:sender:from:to:cc:subject\r
+       :date:message-id:x-mailer:in-reply-to:references;\r
+       bh=0AcfGDF0GFZRvMFHx+Tn5LmvY9dZr6hOkIKkwuFeXNI=;\r
+       b=pvGRi30RFhv+Dk0IQb5kN7VnlZk2cNqPyo6LVal62jPNGBC+DJJubJxUxxErLlctCA\r
+       Mrm+rPiIHVIkcWfcfDsxumsMSEgdP4VnYVC5Q0WXKUbHvQudLPA7bkLEWASez9B9yYLG\r
+       QV1OPoL92IlnRmGQ64Nn7hKEeMlzEAs3C8dOM=\r
+DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;\r
+       h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to\r
+       :references;\r
+       b=kHkCUeDJ2X/jH0/dnsf7SLeHrhV7xJ1AAmAGMWyiIcIbyLqMOWwFmEfNsvC9f1sLum\r
+       ZZDEKcUnySEG2eJxPkRPaHnuOm+A2MtRFG02tVbwTmBPBoXzpv6Xz0vxmtEcnTbXnHEz\r
+       9Zc5J0HxGLKO9F2RB8F7mtUrYCzS5I2o/avRg=\r
+Received: by 10.204.151.194 with SMTP id d2mr3831764bkw.85.1259751606703;\r
+       Wed, 02 Dec 2009 03:00:06 -0800 (PST)\r
+Received: from localhost.localdomain (vawpc43.ethz.ch [129.132.59.11])\r
+       by mx.google.com with ESMTPS id 21sm1280205fkx.25.2009.12.02.03.00.04\r
+       (version=TLSv1/SSLv3 cipher=RC4-MD5);\r
+       Wed, 02 Dec 2009 03:00:05 -0800 (PST)\r
+Sender: Jed Brown <five9a2@gmail.com>\r
+From: Jed Brown <jed@59A2.org>\r
+To: cworth@cworth.org\r
+Date: Wed,  2 Dec 2009 12:00:35 +0100\r
+Message-Id: <1259751635-7496-1-git-send-email-jed@59A2.org>\r
+X-Mailer: git-send-email 1.6.5.3\r
+In-Reply-To: <87vdgp4p5e.fsf@59A2.org>\r
+References: <87vdgp4p5e.fsf@59A2.org>\r
+Cc: notmuch@notmuchmail.org\r
+Subject: [notmuch] [PATCH] Make search filters handle disjunctive queries.\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.12\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Wed, 02 Dec 2009 11:00:09 -0000\r
+\r
+notmuch-search-filter now accepts an arbitrary query and will group if\r
+necessary so that we get\r
+\r
+  tag:inbox AND (gravy OR biscuits)\r
+\r
+instead of the former\r
+\r
+  tag:inbox AND gravy OR biscuits\r
+\r
+Signed-off-by: Jed Brown <jed@59A2.org>\r
+---\r
+ notmuch.el |    5 ++++-\r
+ 1 files changed, 4 insertions(+), 1 deletions(-)\r
+\r
+diff --git a/notmuch.el b/notmuch.el\r
+index 2509651..0bf82f5 100644\r
+--- a/notmuch.el\r
++++ b/notmuch.el\r
+@@ -995,6 +995,8 @@ thread from that buffer can be show when done with this one)."\r
+ (defvar notmuch-search-oldest-first t\r
+   "Show the oldest mail first in the search-mode")\r
\r
++(defvar notmuch-search-disjunctive-regexp      "\\<[oO][rR]\\>")\r
++\r
+ (defun notmuch-search-scroll-up ()\r
+   "Move forward through search results by one window's worth."\r
+   (interactive)\r
+@@ -1327,7 +1329,8 @@ search."\r
+ Runs a new search matching only messages that match both the\r
+ current search results AND the additional query string provided."\r
+   (interactive "sFilter search: ")\r
+-  (notmuch-search (concat notmuch-search-query-string " and " query) notmuch-search-oldest-first))\r
++  (let ((grouped-query (if (string-match-p notmuch-search-disjunctive-regexp query) (concat "( " query " )") query)))\r
++    (notmuch-search (concat notmuch-search-query-string " and " grouped-query) notmuch-search-oldest-first)))\r
\r
+ (defun notmuch-search-filter-by-tag (tag)\r
+   "Filter the current search results based on a single tag.\r
+-- \r
+1.6.5.3\r
+\r