Re: [notmuch] [PATCH] Make search filters handle disjunctive queries.
authorKeith Packard <keithp@keithp.com>
Mon, 23 Nov 2009 18:26:47 +0000 (10:26 +1600)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:35:41 +0000 (09:35 -0800)
c3/f7ce4d442c2e977111715a2b119d55591a3628 [new file with mode: 0644]

diff --git a/c3/f7ce4d442c2e977111715a2b119d55591a3628 b/c3/f7ce4d442c2e977111715a2b119d55591a3628
new file mode 100644 (file)
index 0000000..321bf3b
--- /dev/null
@@ -0,0 +1,98 @@
+Return-Path: <keithp@keithp.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 EE09C431FAE\r
+       for <notmuch@notmuchmail.org>; Mon, 23 Nov 2009 10:26:53 -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 W4mxHZfasADF for <notmuch@notmuchmail.org>;\r
+       Mon, 23 Nov 2009 10:26:52 -0800 (PST)\r
+Received: from keithp.com (home.keithp.com [63.227.221.253])\r
+       by olra.theworths.org (Postfix) with ESMTP id 42935431FBC\r
+       for <notmuch@notmuchmail.org>; Mon, 23 Nov 2009 10:26:52 -0800 (PST)\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by keithp.com (Postfix) with ESMTP id 8967C7600E3;\r
+       Mon, 23 Nov 2009 10:26:51 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at keithp.com\r
+Received: from keithp.com ([127.0.0.1])\r
+       by localhost (keithp.com [127.0.0.1]) (amavisd-new, port 10024)\r
+       with LMTP id Uxyq+LQL6hZq; Mon, 23 Nov 2009 10:26:48 -0800 (PST)\r
+Received: by keithp.com (Postfix, from userid 1033)\r
+       id AB0F7B84011; Mon, 23 Nov 2009 10:26:48 -0800 (PST)\r
+Received: from keithp.com (localhost [127.0.0.1])\r
+       by keithp.com (Postfix) with ESMTP id 9E58C7600E3;\r
+       Mon, 23 Nov 2009 10:26:48 -0800 (PST)\r
+From: Keith Packard <keithp@keithp.com>\r
+To: Jed Brown <jed@59A2.org>, notmuch@notmuchmail.org, cworth@cworth.org\r
+In-Reply-To: <1258999643-30742-1-git-send-email-jed@59A2.org>\r
+References: <1258976966-22407-1-git-send-email-jed@59A2.org>\r
+       <1258999643-30742-1-git-send-email-jed@59A2.org>\r
+Date: Mon, 23 Nov 2009 10:26:47 -0800\r
+Message-ID: <yuny6lxnllk.fsf@aiko.keithp.com>\r
+MIME-Version: 1.0\r
+Content-Type: multipart/signed; boundary="=-=-=";\r
+       micalg=pgp-sha1; protocol="application/pgp-signature"\r
+Subject: Re: [notmuch] [PATCH] Make search filters handle disjunctive\r
+ 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: Mon, 23 Nov 2009 18:26:54 -0000\r
+\r
+--=-=-=\r
+Content-Transfer-Encoding: quoted-printable\r
+\r
+On Mon, 23 Nov 2009 19:07:23 +0100, Jed Brown <jed@59A2.org> wrote:\r
+\r
+> notmuch-search-filter accepts now accepts an arbitrary query and will\r
+> group if necessary so that we get\r
+>=20\r
+>   tag:inbox AND (gravy OR biscuits)\r
+>=20\r
+> notmuch-search-filter-tag now handles multiple terms.  All terms in the\r
+> query except AND and OR are interpreted as tags.\r
+\r
+Remember to split patches which do more than one thing into separate\r
+commits.\r
+\r
+> +  (let ((grouped-query (if (string-match-p notmuch-search-disjunctive-re=\r
+gexp query) (concat "( " query " )") query)))\r
+> +    (notmuch-search (concat notmuch-search-query-string " and " grouped-=\r
+query) notmuch-search-oldest-first)))\r
+\r
+Is there some reason not to just always add the parens?\r
+\r
+> +  (let ((tagged-query (replace-regexp-in-string notmuch-search-valid-ter=\r
+m-regexp\r
+> +                                            (lambda (match) ; Prepend `tag:' to all except boolean operators\r
+> +                                              (if (string-match-p notmuch-search-boolean-operator-regexp match)\r
+> +                                                  match (concat "tag:" match)))\r
+> +                                            query)))\r
+\r
+This seems useful; how does it deal with the tag completion stuff?\r
+\r
+=2D-=20\r
+keith.packard@intel.com\r
+\r
+--=-=-=\r
+Content-Type: application/pgp-signature\r
+\r
+-----BEGIN PGP SIGNATURE-----\r
+Version: GnuPG v1.4.10 (GNU/Linux)\r
+\r
+iD8DBQFLCtPoQp8BWwlsTdMRAl1BAJ9mOfP6NR4FpfkWfrfbjU/4EArVpwCfUazA\r
+dnK9vAUjOe/iVYyTwOOtEh4=\r
+=hGvK\r
+-----END PGP SIGNATURE-----\r
+--=-=-=--\r