--- /dev/null
+Return-Path: <eg@gaute.vetsj.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 2051A431FC7\r
+ for <notmuch@notmuchmail.org>; Sun, 7 Dec 2014 05:23:58 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+ tests=[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 y+tYP8VUrHpP for <notmuch@notmuchmail.org>;\r
+ Sun, 7 Dec 2014 05:23:54 -0800 (PST)\r
+Received: from mail-wg0-f53.google.com (mail-wg0-f53.google.com\r
+ [74.125.82.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client\r
+ certificate requested) by olra.theworths.org (Postfix) with ESMTPS id\r
+ D62B9431FC0 for <notmuch@notmuchmail.org>; Sun, 7 Dec 2014 05:23:53 -0800\r
+ (PST)\r
+Received: by mail-wg0-f53.google.com with SMTP id l18so4314593wgh.12\r
+ for <notmuch@notmuchmail.org>; Sun, 07 Dec 2014 05:23:52 -0800 (PST)\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+ d=1e100.net; s=20130820;\r
+ h=x-gm-message-state:date:from:subject:to:references:in-reply-to\r
+ :user-agent:message-id:mime-version:content-type\r
+ :content-transfer-encoding;\r
+ bh=B00qyWF0yqa0b4H6F/DfrvmkTcL0VZLYBOzVUrOxzTw=;\r
+ b=AKzG1emUxThrrXvkj9+c5Me4jA9rr59wfSlN0QgazPxnGS6/WQmxzT8Oc8w0j/dLPf\r
+ 26gEkVrotqfaU62NOX6i8a94PR8afeJW/pWGRibcaRSL41X2PUYA6QRaeRMdNM9BxjV5\r
+ JNI0E819SbedIL7V5Jy4eDU0XJxQTiufw1ABqXsJX5aAsnMh6cL/gP1w0NGipy2X6gLn\r
+ ehcd2R4IuSNVESmLoI4ulcNCKi3Wp1WltWIFfnbOKsMdorstgb+3sC5WrQY4tbnf2M3v\r
+ /yR/7lgGGlP3DkBH3lMg7UPArDHdU68TKxOxHLkbFXYlPE1qenE9SFU6VQuF4GNA6bms\r
+ lqiw==\r
+X-Gm-Message-State:\r
+ ALoCoQmEXCGkZCgf4TuLB1IsEd6rl2LjZx6YMMD98Da7XXCp6PlTGCQ7HsfjrjdNhz/XxEV5i5zn\r
+X-Received: by 10.180.98.138 with SMTP id ei10mr17583394wib.32.1417958632562; \r
+ Sun, 07 Dec 2014 05:23:52 -0800 (PST)\r
+Received: from localhost (216.89-20-249.enivest.net. [89.20.249.216])\r
+ by mx.google.com with ESMTPSA id\r
+ xt9sm20062035wjc.42.2014.12.07.05.23.51 for <multiple recipients>\r
+ (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\r
+ Sun, 07 Dec 2014 05:23:51 -0800 (PST)\r
+Date: Sun, 07 Dec 2014 13:24:32 +0000\r
+From: Gaute Hope <eg@gaute.vetsj.com>\r
+Subject: Re: notmuch_query_add_tag_excluded and notmuch_query_search_threads\r
+To: David Bremner <david@tethera.net>, notmuch@notmuchmail.org\r
+References: <1417905319-astroid-0-i86er7iwg5-10728@strange>\r
+ <87388rfzhw.fsf@maritornes.cs.unb.ca>\r
+In-Reply-To: <87388rfzhw.fsf@maritornes.cs.unb.ca>\r
+User-Agent: astroid/vv0.1-10-g39dd8180 (https://github.com/gauteh/astroid)\r
+Message-Id: <1417958519-astroid-0-ydniq6pte2-8575@strange>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=utf-8; format=flowed\r
+Content-Transfer-Encoding: quoted-printable\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: Sun, 07 Dec 2014 13:23:58 -0000\r
+\r
+Excerpts from David Bremner's message of December 7, 2014 12:52:\r
+> Gaute Hope <eg@gaute.vetsj.com> writes:\r
+>=20\r
+>>\r
+>> I would expect to have the thread matching, I get nothing however. It\r
+>> does show up in: $ notmuch search tag:muted (muted added to excluded\r
+>> tags), but does notmuch search operate with\r
+>> notmuch_query_search_messages?=20\r
+>>\r
+>=20\r
+> I expanded your sample into a full program, and it seems to work ok for\r
+> me. Not sure what the difference might be.\r
+>=20\r
+> [...]\r
+> query =3D notmuch_query_create (nm_db, "tag:muted");\r
+> notmuch_query_add_tag_exclude (query, "muted");\r
+> notmuch_query_set_omit_excluded (query, NOTMUCH_EXCLUDE_TRUE);\r
+\r
+ printf("%d\n", notmuch_query_count_threads (query));\r
+\r
+>=20\r
+> for (threads =3D notmuch_query_search_threads (query);\r
+> notmuch_threads_valid (threads);\r
+> notmuch_threads_move_to_next (threads))\r
+>=20\r
+> [...]\r
+\r
+Thanks,\r
+\r
+I also did an notmuch_query_count_threads (query) as illustrated\r
+above, this returns 0 and also results in the erroneous behavior below. You=\r
+r code works as expected without the _count_threads() call.\r
+\r
+regards, gaute\r
+\r
+=\r