[PATCH] python: Add binding for notmuch_query_add_tag_exclude
authorThibaut Horel <thibaut.horel@gmail.com>
Mon, 11 Aug 2014 04:43:54 +0000 (00:43 +2000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 18:04:11 +0000 (10:04 -0800)
ee/4d621fcd498ebc90a9d0a37a8729da597bfdf8 [new file with mode: 0644]

diff --git a/ee/4d621fcd498ebc90a9d0a37a8729da597bfdf8 b/ee/4d621fcd498ebc90a9d0a37a8729da597bfdf8
new file mode 100644 (file)
index 0000000..16bf1d1
--- /dev/null
@@ -0,0 +1,130 @@
+Return-Path: <thibaut.horel@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 C1340431FAF\r
+       for <notmuch@notmuchmail.org>; Sun, 10 Aug 2014 21:44:17 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.799\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+       FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\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 K0bkou9R0w38 for <notmuch@notmuchmail.org>;\r
+       Sun, 10 Aug 2014 21:44:11 -0700 (PDT)\r
+Received: from mail-qa0-f54.google.com (mail-qa0-f54.google.com\r
+       [209.85.216.54]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id C122B431FAE\r
+       for <notmuch@notmuchmail.org>; Sun, 10 Aug 2014 21:44:11 -0700 (PDT)\r
+Received: by mail-qa0-f54.google.com with SMTP id k15so7619139qaq.27\r
+       for <notmuch@notmuchmail.org>; Sun, 10 Aug 2014 21:44:11 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+       h=date:from:to:subject:message-id:mime-version:content-type\r
+       :content-disposition:user-agent;\r
+       bh=GhmovSHkbVaoQZWnbj2K9ymH9Kqr2i89DPLskRApGuw=;\r
+       b=hVFq1gbW9HGbc+TSTAV0zJWEKG7udACeRFZiikG6KeEVhovHiI+wjmo0HBwWip3Jgh\r
+       fKtB5XfyuA4MZDDQs/Mf7OdyJc0hIM7y7xBDKsEZo3MQjTTU+Ps4cq+QvJ3S8G1cLAtl\r
+       JkhZitdL/JbkZx/T78EOookH+3WfIH0g1IUsWNRKq9BWHDWWGEC0Aj1Pk2+I3BNGu6NX\r
+       6LXqsp4vf+9yjUxzpxz7g279f89uGOyTfJxvzyijCsFpDgeMIEfflLw/ov1NfUt2iczQ\r
+       7oj/swcmTeN8dFIIze+LXKuIRVJ0NsFc4qT9Q/DkF3c+Gm9quvSst9dZh2aPUXM9OGAv\r
+       OaBw==\r
+X-Received: by 10.140.22.69 with SMTP id 63mr45538863qgm.23.1407732249090;\r
+       Sun, 10 Aug 2014 21:44:09 -0700 (PDT)\r
+Received: from localhost (wrls-140-247-19-103.wrls.harvard.edu.\r
+       [140.247.19.103]) by mx.google.com with ESMTPSA id\r
+       n20sm19372053qar.38.2014.08.10.21.44.07 for <notmuch@notmuchmail.org>\r
+       (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\r
+       Sun, 10 Aug 2014 21:44:08 -0700 (PDT)\r
+Date: Mon, 11 Aug 2014 00:43:54 -0400\r
+From: Thibaut Horel <thibaut.horel@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH] python: Add binding for notmuch_query_add_tag_exclude\r
+Message-ID: <20140811044354.GA18790@spoon.client.fas.harvard.edu>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii; format=flowed\r
+Content-Disposition: inline\r
+User-Agent: Mutt/1.5.23 (2014-03-12)\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\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, 11 Aug 2014 04:44:17 -0000\r
+\r
+Implemented as the method `exclude_tag` of the class `Query`. This method takes\r
+one argument, a string containing the name of the tag to exclude.\r
+---\r
+ NEWS                                  |  5 +++++\r
+ bindings/python/docs/source/query.rst |  2 ++\r
+ bindings/python/notmuch/query.py      | 15 +++++++++++++++\r
+ 3 files changed, 22 insertions(+)\r
+\r
+diff --git a/NEWS b/NEWS\r
+index f7aaedf..2d85090 100644\r
+--- a/NEWS\r
++++ b/NEWS\r
+@@ -22,6 +22,11 @@ from the config file.  Use something like:\r
+       ...\r
+     },\r
\r
++Python Bindings\r
++---------------\r
++\r
++Add support for `notmuch_query_add_tag_exclude`\r
++\r
+ Notmuch 0.18.1 (2014-06-25)\r
+ ===========================\r
\r
+diff --git a/bindings/python/docs/source/query.rst b/bindings/python/docs/source/query.rst\r
+index ddfc348..044b573 100644\r
+--- a/bindings/python/docs/source/query.rst\r
++++ b/bindings/python/docs/source/query.rst\r
+@@ -32,6 +32,8 @@\r
+       :attr:`Query.SORT`) if explicitely specified via\r
+       :meth:`set_sort`. By default it is set to `None`.\r
\r
++   .. automethod:: exclude_tag\r
++\r
+    .. automethod:: search_threads\r
\r
+    .. automethod:: search_messages\r
+diff --git a/bindings/python/notmuch/query.py b/bindings/python/notmuch/query.py\r
+index b11a399..94773ac 100644\r
+--- a/bindings/python/notmuch/query.py\r
++++ b/bindings/python/notmuch/query.py\r
+@@ -118,6 +118,21 @@ class Query(object):\r
+         self.sort = sort\r
+         self._set_sort(self._query, sort)\r
\r
++    _exclude_tag = nmlib.notmuch_query_add_tag_exclude\r
++    _exclude_tag.argtypes = [NotmuchQueryP, c_char_p]\r
++    _exclude_tag.resttype = None\r
++\r
++    def exclude_tag(self, tagname):\r
++        """Add a tag that will be excluded from the query results by default.\r
++\r
++        This exclusion will be overridden if this tag appears explicitly in the\r
++        query.\r
++\r
++        :param tagname: Name of the tag to be excluded\r
++        """\r
++        self._assert_query_is_initialized()\r
++        self._exclude_tag(self._query, _str(tagname))\r
++\r
+     """notmuch_query_search_threads"""\r
+     _search_threads = nmlib.notmuch_query_search_threads\r
+     _search_threads.argtypes = [NotmuchQueryP]\r
+-- \r
+2.0.4\r
+\r