From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:203:b4db::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id SAy5H2plyGEZoQAAgWs5BA (envelope-from ) for ; Sun, 26 Dec 2021 13:51:54 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id wGsgHWplyGFSBAAA9RJhRA (envelope-from ) for ; Sun, 26 Dec 2021 13:51:54 +0100 Received: from mail.notmuchmail.org (yantan.tethera.net [IPv6:2a01:4f9:c011:7a79::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 2F1D132CA4 for ; Sun, 26 Dec 2021 13:51:54 +0100 (CET) Received: from yantan.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 9999B5F725; Sun, 26 Dec 2021 12:51:50 +0000 (UTC) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by mail.notmuchmail.org (Postfix) with ESMTP id 9F64F5F71B for ; Sun, 26 Dec 2021 12:51:47 +0000 (UTC) Received: by fethera.tethera.net (Postfix, from userid 1001) id 2895F5FC42; Sun, 26 Dec 2021 07:51:47 -0500 (EST) Received: (nullmailer pid 2022783 invoked by uid 1000); Sun, 26 Dec 2021 12:51:46 -0000 From: David Bremner To: Ramakrishnan Muthukrishnan Subject: Re: unread message appear `folded' In-Reply-To: <20130805185947.GD7794@mit.edu> References: <20130805185947.GD7794@mit.edu> Date: Sun, 26 Dec 2021 08:51:46 -0400 Message-ID: <87k0frmsv1.fsf@tethera.net> MIME-Version: 1.0 Message-ID-Hash: MEAIHNY4I3W5OVAEORLQQN4XY6EF5XRC X-Message-ID-Hash: MEAIHNY4I3W5OVAEORLQQN4XY6EF5XRC X-MailFrom: david@tethera.net X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: notmuch@notmuchmail.org X-Mailman-Version: 3.3.3 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_IN X-Migadu-Country: DE ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1640523114; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-owner:list-unsubscribe:list-subscribe:list-post; bh=JUncGuCtEAjg/xPIdoricAu6RrZwUN4SlBqchrN3+zs=; b=uLxSkEy1hyVhnwxuW90eeu020EmNVSjsd1uC6c3MPkPCk7tSNiatVsiyKe2YiMfnEeb9gz t0URXjZpxtlMywilB3zZHzV28mB+VI3O0xEjVM0Axs6WAv3owLMvf/J8ZlAJdWSqwh7l4O Fz5rGTR6fB9uXwkx0o8O8Qvdr9UtdLksysDdz6aaeQTzys6UP2r+ARbM3uISx0ET2qfqMv bWafMYef8qg98E3SyTH5XM6dZ/xkTz4FDkrFCZoAQZkVNeIU5Bt7Ju8gxZALBK1V24QNKS 4L5IPvYHMpMhfF1O+olzzFKOzhd0t8RaroQtKB115Ft6gyFYNgeZCwMH5x2aww== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1640523114; a=rsa-sha256; cv=none; b=VT1Z1a7bg7DSekObt9prw2S41HaDjY0xsTLVlzm4DxaA3jQhmT9BeKSYcANECYoa5J3h6M +gYnrTbTxfXk1NuUn6rG1ZpopsLXH7CEgB6hclRktkPwRvlyieVRS8bCvSAA30TU9cQCXB czshYCJ7GGs5H/WCL9nLqoXib9K/k21PcYqNQXkm5/12Iyn91dyHWFS+kat4MJ+9gmhjas iyo9LpQVexKDB2qghJ3MtV6K4ABNv3x9QBEs0VjXX4ibj/pnoEVzXXeZXdPfX4nJhBfUjO mcO3Pk0wPIBzaZJ73RrlU6g05LT/YocxkErl4gpPqMavF8/HNeK4Z9ilDfiFVQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2a01:4f9:c011:7a79::1 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: -2.18 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2a01:4f9:c011:7a79::1 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: 2F1D132CA4 X-Spam-Score: -2.18 X-Migadu-Scanner: scn0.migadu.com X-TUID: WxTlftRW26i3 Austin Clements writes: > Quoth Ramakrishnan Muthukrishnan on Aug 05 at 11:35 pm: >> Ramakrishnan Muthukrishnan writes: >> >> > Hi, >> > >> > Pardon me for using non-standard terms here because of lack of knowledge >> > of the language used in the email world. >> > >> > I have this thread in which some messages are tagged unread. When the >> > thread is opened, I see that those unread messages are not shown in full >> > in the threaded view. Instead they appear `folded' with only the summary >> > appearing in the thread, as if they are read. >> > >> > Here is a screenshot: http://i.imgur.com/Eh8SKe6.png >> > >> > I am attaching the messages in the thread shown in the screenshot as a >> > tar.bz2 file. >> >> I just forgot to mention that I see this only when I do a >> notmuch-search with `*' and not when I search with a tag. > > '*' turns out to be the key. When showing a thread, > notmuch-show-build-buffer constructs a new query from the thread ID > and the original search query of the form > > thread:X and (original query) > > If the original query is '*', this is > > thread:X and (*) > > But * isn't part of the Xapian query syntax. Notmuch specially > handles queries that exactly match "*" before passing the query to > Xapian. When * is embedded in a larger query, this special casing > doesn't apply. In fact, Xapian parses this query as > > (Tmail AND (and:(pos=1) FILTER GX)) > > The "and" in the query turned into a plain search term (the "AND" is a > proper boolean operator, but is unrelated to the provided query). > > This is a symptom of a general problem where we assume queries are > textually composable, when they are not. We have the same problem at > least in notmuch-search-filter and in notmuch tag query optimization. > In this particular case, the * causes Xapian's query grammar to fail > to parse the query, which Xapian handles by re-parsing the entire > query will all query features disabled (which includes disabling > support for boolean operators). Unfortunately, just handling * better > isn't really a solution because it's just one of many things that > violates query composability. > > Some solutions I can see are: > > 1) Switch to a composable query syntax (which would include *). This, > obviously, requires a custom query parser, but is the most > localized change I can think of and keeps queries as strings. > > 2) Never construct queries by pasting strings together. This would > require changes to both the libnotmuch and CLI interfaces and > queries could no longer be strings, but in the words of Alan > Perlis, the string is a stark data structure. (In the case of > show, I would actually love it if we could specify separate search > and match queries because that would eliminate --entire-thread as > well as the fallback in notmuch-show-build-buffer when search > returns nothing, but I digress.) > > 3) Keep queries as plain strings, but switch to some hybrid syntax > that lets us combine Xapian queries with composable operators > parsed by notmuch. When we need to combine queries, do it using > the composable operators. This actually may not be a bad way to > transition to a full custom query parser; I think it would be > relatively easy to take over parsing Xapian's boolean syntax, but > leave the "prob" parsing to Xapian. > > I lean towards 3 because it seems like the least disruptive and offers > a smooth transition to 1. Update on this very old bug. As of notmuch 0.34 the notmuch CLI supports both 1 and 3 via --query=sexp, if compiled with the (currently optional) sfsexp library. My plan is that once sfsexp is sufficiently widely available (whatever that turns out to mean) to make it a mandatory dependency. At that point we can transition the emacs front end to using notmuch-sexp-queries(7) to compose queries. In principle we could start that work now by checking "notmuch config get built_with.sexp_queries". I'm not sure if it's worth the extra complexity, but it would make the transition smoother, and probably help test the s-expression query parser. d