From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id kPmZEyL8cWXgEAEA9RJhRA:P1 (envelope-from ) for ; Thu, 07 Dec 2023 18:08:50 +0100 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id kPmZEyL8cWXgEAEA9RJhRA (envelope-from ) for ; Thu, 07 Dec 2023 18:08:50 +0100 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 9F80B150F3 for ; Thu, 7 Dec 2023 18:08:49 +0100 (CET) Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=idiomdrottning.org header.s=idiomdrottningorg header.b=mWNXtKXL; dmarc=fail reason="SPF not aligned (relaxed)" header.from=idiomdrottning.org (policy=reject); 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 ARC-Seal: i=1; s=key1; d=yhetil.org; t=1701968930; a=rsa-sha256; cv=none; b=kPJmEtR0ZX0nVuhXIto9EFkUi0AMBNsZeD5QSFZvdcBCOzhselWGxaTBVcx7N5qB+EXQFT csglq18kGciYjnqDLZgRZkNqz7tBjdZ9XJlJMjWXJFC26/XsK/KcF8CcKOd7YgQAiuIhC6 7NovKRqTn+Hf4dwl75YgDBBopmtz/a6yOFCrhunxJUzRa4Hqxh7zroZUrcUJEinbJ8Z4FA UZv84hXmsuqcj4bv29kWHYThMOw9acWWSzM0FgTYocN0jnJGSjCeV1bkvvH+5MRZL3r0gP 4YmD7BfgOHnnnTxJ7M0NzkN2oj+a7UXxUL3ZLQiGhXlbL+P9XCxuZk9qfKrsUA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=idiomdrottning.org header.s=idiomdrottningorg header.b=mWNXtKXL; dmarc=fail reason="SPF not aligned (relaxed)" header.from=idiomdrottning.org (policy=reject); 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 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1701968930; 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=C7JJXDglYjzYIkiQd1xYTIOwuHgXMg9rAF84fT0Vq94=; b=S3mxkJqzeEf70syZJD5tX2W3RTzbq6CS5oV4fH5LAPVxEeMyAXWZOV+1ETDwdI7ZqBbbzp tB6LZoxCITGKvE4/7pp6p0vXLUlxtb0IDrRV0tXMKZxK8Ud2gnllzjqsWq/QYXczldQEvr ixeTG5AfuWHxY1JoBe5p+qE8Jnldzf3jMbX+KNIWcHFhKISZD6k0VKLwyfALU0X7GXwAg/ giHSKDSU4Dgy2G8mdkgXDyB+F0A3KWr3UBZ6IorW9wog6x8NDyxUi2qv7bBrxm9emlQ/ez unLyH5P9veqR5VWeYYJuMvqma9advpqd2yayi+xCyY0f2oBb7Yc3dgOGuHVhmA== Received: from yantan.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 8E0CB60975; Thu, 7 Dec 2023 17:08:40 +0000 (UTC) X-Greylist: delayed 342 seconds by postgrey-1.36 at yantan; Thu, 07 Dec 2023 17:08:37 UTC Received: from halsen.idiomdrottning.org (halsen.idiomdrottning.org [IPv6:2600:3c02:e000:179::7]) by mail.notmuchmail.org (Postfix) with ESMTPS id B51A75E504 for ; Thu, 7 Dec 2023 17:08:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=idiomdrottning.org; s=idiomdrottningorg; t=1701968577; bh=F8dYzrRGEdo1Dqry+s8b1+UCEEasvYiVF+J8q2FmCIE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mWNXtKXLQ3EtmwbanONTlt7edidcj9fdV0+ErNI3vJGuEOErzJsi4GTzj21CzcMq5 6E9SNtL1BlDjbt7K9yMgyrQ6If8pyW/j+GOqiZ/5jTSAqSeEh+f9f15l+HLuAIgAQ7 +LTRcSNUuhvdcU0PfcNT0B2psPBRJ/4/5to+p6i7fz14LOOe6fcVCMZh2S95TyI08j vYmfGMgPxUXXRA231htcAesEqyWZB2wFREM1VVI2fwvZiAdFbMuOQ0QSzdsvA5v0K0 PYOj7o/6nhboHQjP+0dnuNV2n3VXVmvv77oRasNLI0ktmGKwi2gsyilr3ipQwOn0ma uY+P8hWAWfQ5Q== Received: from localhost (31-211-247-254.customers.ownit.se [31.211.247.254]) by halsen.idiomdrottning.org (Postfix) with ESMTPSA id A289121E1D; Thu, 7 Dec 2023 18:02:56 +0100 (CET) From: Sandra Snan To: notmuch@notmuchmail.org Subject: [PATCH 2/2] Add notmuch-search-show-or-unthread Date: Thu, 7 Dec 2023 18:02:47 +0100 Message-Id: <20231207170247.504315-2-sandra.snan@idiomdrottning.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231207170247.504315-1-sandra.snan@idiomdrottning.org> References: <20231207170247.504315-1-sandra.snan@idiomdrottning.org> MIME-Version: 1.0 Message-ID-Hash: TQDVRHPVFC5SACRCPFXIJBQBNVEOTSSX X-Message-ID-Hash: TQDVRHPVFC5SACRCPFXIJBQBNVEOTSSX X-MailFrom: sandra.snan@idiomdrottning.org 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-Scanner: mx13.migadu.com X-Migadu-Spam-Score: 6.00 X-Spam-Score: 6.00 X-Migadu-Queue-Id: 9F80B150F3 X-Migadu-Spam: Yes X-Spam: Yes X-TUID: jt4jSmkV2zy9 This is a dispatch function from the search view that if a thread is small, it shows it with `notmuch-search-show-thread`, and if it's big, it shows it with `notmuch-search-show-or-unthread`. On my own machine I've bound it to `RET` and to `` in the notmuch-search-mode-map, but that binding isn't part of this patch. 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. 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. --- emacs/notmuch.el | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/emacs/notmuch.el b/emacs/notmuch.el index c8f53625..e348f660 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -564,6 +564,19 @@ Return non-nil on success." (message "No such thread with that id found!") nil))) +(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)) + (message "No such thread with that id found!") + nil))) + (defun notmuch-tree-from-search-current-query () "Tree view of current query." (interactive) -- 2.39.2