--- /dev/null
+Return-Path: <wking@tremily.us>\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 CF0836DE1A3A\r
+ for <notmuch@notmuchmail.org>; Fri, 1 Jan 2016 22:09:56 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.042\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.042 tagged_above=-999 required=5 tests=[AWL=0.043, \r
+ DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001,\r
+ SPF_PASS=-0.001] 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 jLmU1MdYz0ty for <notmuch@notmuchmail.org>;\r
+ Fri, 1 Jan 2016 22:09:53 -0800 (PST)\r
+Received: from resqmta-po-06v.sys.comcast.net (resqmta-po-06v.sys.comcast.net\r
+ [96.114.154.165])\r
+ by arlo.cworth.org (Postfix) with ESMTPS id 596366DE1830\r
+ for <notmuch@notmuchmail.org>; Fri, 1 Jan 2016 22:09:48 -0800 (PST)\r
+Received: from resomta-po-11v.sys.comcast.net ([96.114.154.235])\r
+ by resqmta-po-06v.sys.comcast.net with comcast\r
+ id 0u9U1s00254zqzk01u9mMQ; Sat, 02 Jan 2016 06:09:46 +0000\r
+Received: from mail.tremily.us ([73.221.72.168])\r
+ by resomta-po-11v.sys.comcast.net with comcast\r
+ id 0u7k1s0033dr3C901u7kfW; Sat, 02 Jan 2016 06:07:45 +0000\r
+Received: from ullr.tremily.us (unknown [192.168.10.7])\r
+ by mail.tremily.us (Postfix) with ESMTPS id E35841B2F577;\r
+ Fri, 1 Jan 2016 22:07:43 -0800 (PST)\r
+Received: (nullmailer pid 15115 invoked by uid 1000);\r
+ Sat, 02 Jan 2016 06:07:51 -0000\r
+From: "W. Trevor King" <wking@tremily.us>\r
+To: notmuch@notmuchmail.org\r
+Cc: David Bremner <david@tethera.net>,\r
+ Tomi Ollila <tomi.ollila@iki.fi>, Jani Nikula <jani@nikula.org>,\r
+ Carl Worth <cworth@cworth.org>, "W. Trevor King" <wking@tremily.us>\r
+Subject: [PATCH v2 3/4] nmbug-status: Wrap query phrases in parentheses when\r
+ and-ing together\r
+Date: Fri, 1 Jan 2016 22:07:42 -0800\r
+Message-Id:\r
+ <a82a76a738a823df9b56c25e9b34d9523d5d4395.1451683912.git.wking@tremily.us>\r
+X-Mailer: git-send-email 2.1.0.60.g85f0837\r
+In-Reply-To: <cover.1451683912.git.wking@tremily.us>\r
+References: <cover.1451683912.git.wking@tremily.us>\r
+In-Reply-To: <cover.1451683912.git.wking@tremily.us>\r
+References: <cover.1451683912.git.wking@tremily.us>\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net;\r
+ s=q20140121; t=1451714986;\r
+ bh=EsWtt64FdfG0VjYB6cAEuXizbJYNPg+zTVeSeV5aqjs=;\r
+ h=Received:Received:Received:Received:From:To:Subject:Date:\r
+ Message-Id;\r
+ b=rmnOAFJyO9Hk2kN1jKsE0gN1r9Y6oJstHlAC4M1oI1uF1uNCCw2jJqhKU6IAOL1j5\r
+ 5QErpH5NffRQa4pL0T9MwF1NBHBncy0Vrxd5i5cZtrg4BvoWZqpyKMahGjjxutEgY0\r
+ MX8b/puiTVMQvjMtl/xewAoqnJJtgyf+6orhmuKTvuqo3YD1JhwHf7uE/J4y5dVq8q\r
+ WNcJSlbHfRXzpmqkG+TP4ugQzm2k2d+aBQmnNAX4mpenXSi/An0J3/71ZSGuUG8guQ\r
+ kiBQsqHUiRXLaeSI/L3Rd/GdJ2oEzbiSJL8UK9TB8Y3bJdC9DFBs09K/HjoSlhLRGy\r
+ LZaeqZFnRUKxQ==\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.20\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <https://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: <https://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sat, 02 Jan 2016 06:09:57 -0000\r
+\r
+For example:\r
+\r
+ "query": ["tag:a", "tag:b or tag:c"]\r
+\r
+is now converted to:\r
+\r
+ ( tag:a ) and ( tag:b or tag:c )\r
+\r
+instead of the old:\r
+\r
+ tag:a and tag:b or tag:c\r
+\r
+This helps us avoid confusion due to Xapian's higher-precedence AND\r
+[1], where the old query would be interpreted as:\r
+\r
+ ( tag:a and tag:b ) or tag:c\r
+\r
+[1]: http://xapian.org/docs/queryparser.html\r
+---\r
+ NEWS | 3 +++\r
+ devel/nmbug/nmbug-status | 5 +++--\r
+ 2 files changed, 6 insertions(+), 2 deletions(-)\r
+\r
+diff --git a/NEWS b/NEWS\r
+index 9f2e860..403a046 100644\r
+--- a/NEWS\r
++++ b/NEWS\r
+@@ -4,6 +4,9 @@ Notmuch 0.22 (UNRELEASED)\r
+ nmbug-status\r
+ ------------\r
+ \r
++`nmbug-status` now wraps query phrases in parentheses when and-ing\r
++them together, to avoid confusion about clause grouping.\r
++\r
+ `nmbug-status` now supports `meta.message-url` to override the Gmane\r
+ template. For example, you can use:\r
+ \r
+diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status\r
+index d72f1db..7d3a76e 100755\r
+--- a/devel/nmbug/nmbug-status\r
++++ b/devel/nmbug/nmbug-status\r
+@@ -167,7 +167,8 @@ class Page (object):\r
+ view['title'], sort_key))\r
+ if 'query-string' not in view:\r
+ query = view['query']\r
+- view['query-string'] = ' and '.join(query)\r
++ view['query-string'] = ' and '.join(\r
++ '( {} )'.format(q) for q in query)\r
+ q = notmuch.Query(database, view['query-string'])\r
+ q.set_sort(sort)\r
+ threads = self._get_threads(messages=q.search_messages())\r
+@@ -411,7 +412,7 @@ if args.list_views:\r
+ elif args.get_query != None:\r
+ for view in config['views']:\r
+ if args.get_query == view['title']:\r
+- print(' and '.join(view['query']))\r
++ print(' and '.join('( {} )'.format(q) for q in view['query']))\r
+ sys.exit(0)\r
+ else:\r
+ # only import notmuch if needed\r
+-- \r
+2.1.0.60.g85f0837\r
+\r