From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id SLL3F9I3omb2mwAA62LTzQ:P1 (envelope-from ) for ; Thu, 25 Jul 2024 11:32:34 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id SLL3F9I3omb2mwAA62LTzQ (envelope-from ) for ; Thu, 25 Jul 2024 13:32:34 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=tethera.net header.s=2024 header.b=izhc+TNG; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 135.181.149.255 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1721907154; 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:dkim-signature; bh=Hy9twkmHiY+4sKZawWFHaYn2+mb/lXX/ddz19kln/48=; b=ubyfDEHZX5bIzWAqlzH8HXOS5X2Ys64t9bWC4nENaarESlfdlXsWWbe+fDFlMUjOLNmwfZ f9tU3JNU6Z9frvMhyLk4vIrVZY+MtgD1mTP6jQGzV111J+kIj4jOmteXSjk2kWiyraO97A fm+p0+5zZzJTxr6eKusSXr7vdZJVbEnWZNkqF1PUxlZ1KK1fd3uemlOxeIC5VNTZLi1XON PnuMpzQHj/ltWnmFu1mamRSU7CYaRcGfPJEFxtxsCNhu7sP7GmzwepmpH/QvrH2bOvv74l pEY2vFCaHGUWF5BaOKuhwp+WnNljG7p29+RkZ/G5FWMa+1vrxYJSLtWMrCip3g== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=tethera.net header.s=2024 header.b=izhc+TNG; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 135.181.149.255 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org; dmarc=none ARC-Seal: i=1; s=key1; d=yhetil.org; t=1721907154; a=rsa-sha256; cv=none; b=u+Q1HCpShj8Y+AFdNum/ddA5fHi3+esl86BQhYFUTVICDHmj+mNMFJkRcoAzjUeUIneSWX n9CvpESqpt+s9M4zRRcCFTRqzF3Gfy5z1UCe5ddOfU2jYSIvXbuCNxXzbaC6XyRWXQUfOx q2eE6iJC+2Dyf2H9AM4IcFVPVXaEfIm9rvNA2UJR6ScNBLwJGup6U/V1aSfvYGBAJhBCYO peNKE3L2CCVqqYFWSj6nJmItFAvqD+xoYu5MJwZwZKpTByfxTQC2oPkx8cieKnZv17mkVr ApUFWoQnaUEjWZ9MJO55J80D+/nLWMZH7d0yOpLC90LOG36Eo/1Q+JAABmJn4Q== Received: from mail.notmuchmail.org (yantan.tethera.net [135.181.149.255]) (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 3DD755466C for ; Thu, 25 Jul 2024 13:32:34 +0200 (CEST) Received: from yantan.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 051405F4A9; Thu, 25 Jul 2024 11:32:32 +0000 (UTC) Received: from phubs.tethera.net (phubs.tethera.net [192.99.9.157]) by mail.notmuchmail.org (Postfix) with ESMTPS id 8F1825F3A4 for ; Thu, 25 Jul 2024 11:32:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tethera.net; i=@tethera.net; q=dns/txt; s=2024; t=1721907148; h=from : to : cc : subject : in-reply-to : references : date : message-id : mime-version : content-type : from; bh=5c55092LlahYHQLMAPp1a/wyDcz8MF1gD6Fv0R4rNd4=; b=izhc+TNGXlmBpZW36eps/7NqwEceqWfy4mtbtxArtVNeYgWfcmttU77IBvEZ7hbLjyfEv 6DMaBJsB1ooMuRIj1yTuNdpY8QPHOBcEaWNARLCTM11RdtCe7QYj8U8LUS0KG0i30rOAbY5 BhcIiHV4T94Bu9X1sqxg1w4BojnyMRxEyz4odwzDy4kw+HoTfy0V1J2+DiDaq/8686I+cw2 lLDY8iE7pM0uxDC/j0ET/zLsic5S0l0zYZucKETJ8+SN2vjW1QRAW3o/q7MVwoq/IrptfYi ewx1+7c8/8HZ9rfCtXlDa0KUhAL9mss+fKgDOqGfzWJmwsC1wXR9hgwVw2Gw== Received: from tethera.net (unknown [210.110.131.58]) by phubs.tethera.net (Postfix) with ESMTPS id 4EBFC18006E; Thu, 25 Jul 2024 08:32:27 -0300 (ADT) Received: (nullmailer pid 527264 invoked by uid 1000); Thu, 25 Jul 2024 11:32:23 -0000 From: David Bremner To: Sandra Snan , notmuch@notmuchmail.org Subject: Re: [PATCH 2/2] Add notmuch-search-show-or-unthread In-Reply-To: <20231207170247.504315-2-sandra.snan@idiomdrottning.org> References: <20231207170247.504315-1-sandra.snan@idiomdrottning.org> <20231207170247.504315-2-sandra.snan@idiomdrottning.org> Date: Thu, 25 Jul 2024 20:32:23 +0900 Message-ID: <87v80tiu60.fsf@tethera.net> MIME-Version: 1.0 Message-ID-Hash: IWA56U4YV32YCFLLS24V7ETILGJGWKV3 X-Message-ID-Hash: IWA56U4YV32YCFLLS24V7ETILGJGWKV3 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: Sandra Snan 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-Country: DE X-Migadu-Flow: FLOW_IN X-Migadu-Queue-Id: 3DD755466C X-Migadu-Scanner: mx13.migadu.com X-Migadu-Spam-Score: -2.87 X-Spam-Score: -2.87 X-TUID: Xl1A4KM29ENM Sandra Snan writes: > > It shells out to notmuch count to see if the thread is big or small. > "Big" is hardcoded to ten messages or lower, if we want to introduce a > variable for that instead, that might be great. Yes, I think a defcustom is called for. > > It's a deliberate choice to count all the messages in the thread, not > just ones that are part of the search (a.k.a. the ones that will show > up in the unthreaded view if the thread is big). The reason for that > is that that's the number that matters when it comes to how well > `notmuch-search-show-thread` can handle it. That's by design. So if > there's a thread with 100000 messages and four of them show up in the > search (maybe because they have a particular tag or date), it'll see > that the thread is big and "explode" it and then show those four new > messages in a flat view. Some of that explanation can maybe go in the docstring of the newly defined customize variable > > +(defun notmuch-search-show-or-unthread () > + "If the thread is small, show it the normal notmuch way, and if > +it's big, show the messages separatley in a buffer so you can > +visit them individually." > + (interactive) > + (let ((thread-id (notmuch-search-find-thread-id))) > + (if thread-id > + (if (< 11 (notmuch-call-notmuch-sexp "count" thread-id)) > + (notmuch-search-unthread-thread) > + (notmuch-search-show-thread)) emacs wants to indent this line differently, so please follow its lead here. > + (message "No such thread with that id found!") > + nil))) I guess we should think about a default binding for this. One option is to replace the default notmuch-search-show-thread binding, and just set the threshhold very high so that most users will not notice the change. There is a slight performance penalty from add notmuch count; I'm not sure if this is noticable.