From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id KPdyAtYUuGDaCQEAgWs5BA (envelope-from ) for ; Thu, 03 Jun 2021 01:31:34 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id qKBbONUUuGB8ZQAAbx9fmQ (envelope-from ) for ; Wed, 02 Jun 2021 23:31:33 +0000 Received: from mail.notmuchmail.org (nmbug.tethera.net [144.217.243.247]) (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 4F7201CEE5 for ; Thu, 3 Jun 2021 01:31:33 +0200 (CEST) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id CBBF22B227; Wed, 2 Jun 2021 19:31:23 -0400 (EDT) Received: from fethera.tethera.net (fethera.tethera.net [IPv6:2607:5300:60:c5::1]) by mail.notmuchmail.org (Postfix) with ESMTP id 45FA12903E for ; Wed, 2 Jun 2021 19:31:20 -0400 (EDT) Received: by fethera.tethera.net (Postfix, from userid 1001) id 0995A5FD26; Wed, 2 Jun 2021 19:31:19 -0400 (EDT) Received: (nullmailer pid 858597 invoked by uid 1000); Wed, 02 Jun 2021 23:31:16 -0000 From: David Bremner To: Tomi Ollila , David Bremner , Alan Schmitt , notmuch Subject: [PATCH 1/2] emacs/show: add parameter notmuch-show-single-message Date: Wed, 2 Jun 2021 20:31:07 -0300 Message-Id: <20210602233108.855449-2-david@tethera.net> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210602233108.855449-1-david@tethera.net> References: <20210602233108.855449-1-david@tethera.net> MIME-Version: 1.0 Message-ID-Hash: DG6HPC2QMDLGQEHFG6NZE77WDDB5B7WO X-Message-ID-Hash: DG6HPC2QMDLGQEHFG6NZE77WDDB5B7WO X-MailFrom: bremner@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; suspicious-header X-Mailman-Version: 3.2.1 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1622676693; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to: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-unsubscribe:list-subscribe:list-post; bh=rAb+15CWDfearUbcwAnWV6SyIO5viLvW5xmbzScytEg=; b=EP7S3d6s1065X0VxwTrICIEKsa2cm9+MVsHy9RoVXn5Taam5TH5JRdAzbNQCDhgDJGjFMG u++lb2+jEPKn6cWYaM6ONUfPM/1slentzpiVugDrsOYeO3VJ8Xh8dp3p4D+WcmCLronR5/ N5T9K2/hASmqYMu+5RhhUtyMYk3ghWV2XWEI7/BhRVKQnegMWFM2uNMYfdtH/rsQtqJAx0 kvn9Iz1vBvcI9qiYz0lHECkzU6yTueXDYzE1LeVrqXxWvGpRY06BEz5DGsAN4Pgfj6E86U 5yrlYYIROkkpSdhvx1/8bJqGzoos5hfud/hsaWWmoejHrmmm8y1gsFO6wug2tQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1622676693; a=rsa-sha256; cv=none; b=vDTTeZpABX/5UtRHvjBZLXyVI3WFuMen9Ovdz304umsL0idiqfLkjA59HuxKXW1vAYyePz FEcgW4mEdklquPuOjaCXJEyrRVwuKb45fiY8GA7IhDRLECJj7lDp4ITZCS4irLcdkXCHfi Uo8KR9jFeC0OXCkfY0tCnU8PeIlHFlYu3WibhOBDxBK2qD42qDw+GZzPj1MX43KddvkUqs py4CEHxwQGzFWQRWruO3EtJhpM8LKoRXJtSV5QZ3S89P6lT+mwYuXe9SRyUV70ummqREqm t+DxfeC9Jmuo84cFDuxIfvh6Ru8nWoHZsN4wrR5WuBSOTfVKc7jWVv8zwkFqnA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 144.217.243.247 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: -1.02 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 144.217.243.247 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: 4F7201CEE5 X-Spam-Score: -1.02 X-Migadu-Scanner: scn0.migadu.com X-TUID: O56V25RqLFue This dynamically bound variable can be set when the caller of notmuch-show guarantees that exactly one message will match the query. It avoids transporting and parsing the complete thread structure. --- emacs/notmuch-show.el | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index ba93febb..9dca5d7e 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -178,6 +178,8 @@ indentation." (defvar-local notmuch-show-indent-content t) +(defvar-local notmuch-show-single-message nil) + (defvar notmuch-show-attachment-debug nil "If t log stdout and stderr from attachment handlers. @@ -1314,9 +1316,9 @@ Apply the previously saved STATE if supplied, otherwise show the first relevant message. If no messages match the query return NIL." - (let* ((cli-args (cons "--exclude=false" - (and notmuch-show-elide-non-matching-messages - (list "--entire-thread=false")))) + (let* ((cli-args (list "--exclude=false")) + (cli-args (if notmuch-show-elide-non-matching-messages (cons "--entire-thread=false" cli-args) cli-args)) + (cli-args (if notmuch-show-single-message (cons "--part=0" cli-args) cli-args)) (queries (notmuch-show--build-queries notmuch-show-thread-id notmuch-show-query-context)) (forest nil) @@ -1327,6 +1329,8 @@ If no messages match the query return NIL." (while (and (not forest) queries) (setq forest (notmuch-query-get-threads (append cli-args (list "'") (car queries) (list "'")))) + (when (and forest notmuch-show-single-message) + (setq forest (list (list (list forest))))) (setq queries (cdr queries))) (when forest (notmuch-show-insert-forest forest) -- 2.30.2