--- /dev/null
+Return-Path: <david@tethera.net>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by arlo.cworth.org (Postfix) with ESMTP id 8CA816DE0C51\r
+ for <notmuch@notmuchmail.org>; Sat, 5 Sep 2015 19:37:09 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.115\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.115 tagged_above=-999 required=5 tests=[AWL=0.115]\r
+ autolearn=disabled\r
+Received: from arlo.cworth.org ([127.0.0.1])\r
+ by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id vBvKlrqxGOSe for <notmuch@notmuchmail.org>;\r
+ Sat, 5 Sep 2015 19:37:06 -0700 (PDT)\r
+Received: from gitolite.debian.net (gitolite.debian.net [87.98.215.224])\r
+ by arlo.cworth.org (Postfix) with ESMTPS id 7365E6DE0AC2\r
+ for <notmuch@notmuchmail.org>; Sat, 5 Sep 2015 19:37:05 -0700 (PDT)\r
+Received: from remotemail by gitolite.debian.net with local (Exim 4.80)\r
+ (envelope-from <david@tethera.net>)\r
+ id 1ZYPoX-00060k-AY; Sun, 06 Sep 2015 02:36:17 +0000\r
+Received: (nullmailer pid 12152 invoked by uid 1000); Sun, 06 Sep 2015\r
+ 02:35:56 -0000\r
+From: David Bremner <david@tethera.net>\r
+To: Uli Scholler <uli@scholler.net>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH v2] emacs: wrap current search in parens when filtering\r
+In-Reply-To: <87io7rxj6k.fsf@tardis.scholler.priv>\r
+References: <1441231034-9413-1-git-send-email-uli@scholler.net>\r
+ <m2zj142c0q.fsf@guru.guru-group.fi> <87io7rxj6k.fsf@tardis.scholler.priv>\r
+User-Agent: Notmuch/0.20.2+60~gcb08a2e (http://notmuchmail.org) Emacs/24.5.1\r
+ (x86_64-pc-linux-gnu)\r
+Date: Sat, 05 Sep 2015 23:35:56 -0300\r
+Message-ID: <87oahgi8ab.fsf@maritornes.cs.unb.ca>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.18\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: Sun, 06 Sep 2015 02:37:09 -0000\r
+\r
+\r
+Some pretty fussy comments follow. Probably I could have fixed these in\r
+the time it took to write this message ;).\r
+\r
+Uli Scholler <uli@scholler.net> writes:\r
+> + (let ((grouped-query (notmuch-maybe-group-query-string query))\r
+> + (grouped-search-query (notmuch-maybe-group-query-string notmuch-search-query-string)))\r
+\r
+- I didn't find it very obvious which of these introduced variables was\r
+ which. I thought maybe "grouped-original-query" for the second\r
+ one. It's pretty subjective though, so your call.\r
+\r
+- The lines get pretty long here. We try to keep code to 80 columns.\r
+\r
+- Your revised patch isn't in quite the right format for git am;\r
+ the actual commit message get's lost. The unintuitive trick is to add\r
+ commentary in the patch after the ---\r
+ \r
+> + (notmuch-search (if (string= grouped-search-query "*")\r
+> grouped-query\r
+> - (concat notmuch-search-query-string " and " grouped-query)) notmuch-search-oldest-first)))\r
+> + (concat grouped-search-query " and " grouped-query)) notmuch-search-oldest-first)))\r