--- /dev/null
+Return-Path: <bremner@tesseract.cs.unb.ca>\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 03C8B6DE01BA\r
+ for <notmuch@notmuchmail.org>; Thu, 30 Jun 2016 01:40:46 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.005\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.005 tagged_above=-999 required=5\r
+ tests=[AWL=-0.006, HEADER_FROM_DIFFERENT_DOMAINS=0.001]\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 xmWjzgRfTqWR for <notmuch@notmuchmail.org>;\r
+ Thu, 30 Jun 2016 01:40:38 -0700 (PDT)\r
+Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197])\r
+ by arlo.cworth.org (Postfix) with ESMTPS id 075D06DE00BF\r
+ for <notmuch@notmuchmail.org>; Thu, 30 Jun 2016 01:40:37 -0700 (PDT)\r
+Received: from remotemail by fethera.tethera.net with local (Exim 4.84)\r
+ (envelope-from <bremner@tesseract.cs.unb.ca>)\r
+ id 1bIXWB-0007dx-Vn; Thu, 30 Jun 2016 04:40:16 -0400\r
+Received: (nullmailer pid 30879 invoked by uid 1000);\r
+ Thu, 30 Jun 2016 08:40:30 -0000\r
+From: David Bremner <david@tethera.net>\r
+To: David Bremner <david@tethera.net>, notmuch@notmuchmail.org\r
+Subject: RFC: do what jamie wants with notmuch tag\r
+Date: Thu, 30 Jun 2016 10:40:25 +0200\r
+Message-Id: <1467276027-30633-1-git-send-email-david@tethera.net>\r
+X-Mailer: git-send-email 2.8.1\r
+In-Reply-To: <87fustdsx9.fsf@zancas.localnet>\r
+References: <87fustdsx9.fsf@zancas.localnet>\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: Thu, 30 Jun 2016 08:40:46 -0000\r
+\r
+The second patch in particular could be cleaned up; there is definitely some\r
+duplication between the two code paths, so opening the database and\r
+creating a query could/should be refactored.\r
+\r
+It seems somewhat reasonable to have notmuch_query_search_tags in the\r
+API. I would say just document the limitation of ignoring excludes\r
+when querying for all tags, otherwise that optimization (which is a\r
+huge speed improvement) will mostly be useless.\r
+\r
+\r