From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id sC0ECjjDuGAywgAAgWs5BA (envelope-from ) for ; Thu, 03 Jun 2021 13:55:36 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id yNhtBTjDuGAGPgAA1q6Kng (envelope-from ) for ; Thu, 03 Jun 2021 11:55:36 +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)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id C4E3D25B5F for ; Thu, 3 Jun 2021 13:55:31 +0200 (CEST) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id BDBB92B245; Thu, 3 Jun 2021 07:55:15 -0400 (EDT) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by mail.notmuchmail.org (Postfix) with ESMTP id 16A502B239 for ; Thu, 3 Jun 2021 07:55:09 -0400 (EDT) Received: by fethera.tethera.net (Postfix, from userid 1001) id 1EB7A5FD27; Thu, 3 Jun 2021 07:55:08 -0400 (EDT) Received: (nullmailer pid 987723 invoked by uid 1000); Thu, 03 Jun 2021 11:55:04 -0000 From: David Bremner To: notmuch@notmuchmail.org Cc: David Bremner Subject: [PATCH 2/3] emacs/show: add parameter notmuch-show-single-message Date: Thu, 3 Jun 2021 08:54:59 -0300 Message-Id: <20210603115500.987504-3-david@tethera.net> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210603115500.987504-1-david@tethera.net> References: <20210603115500.987504-1-david@tethera.net> MIME-Version: 1.0 Message-ID-Hash: JEDYFYJLUNVLOV57GNM7A2SWPNWF2AT7 X-Message-ID-Hash: JEDYFYJLUNVLOV57GNM7A2SWPNWF2AT7 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=1622721331; 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-unsubscribe:list-subscribe:list-post; bh=rAb+15CWDfearUbcwAnWV6SyIO5viLvW5xmbzScytEg=; b=sPKQnnHHCJBVtxh4ukagTk0Q4DfMQpEjVeu4Xo4n+MeOTx5vqkUXoVUXIH7xuhyLXM6PhS hIp209nptmqo7LjrEbdmbnqR6ZoKTmSspc/PNi5nUfym4531zaBuLW32DFiOGRM6q/7qNs W+Q12V9X4ikUd4uxYkjsgVXpflJ585WJPjIfJweJFzZh6T6CO843sVFBkSsD7cJtNNFWEx gsazLIn984kGfovCx0ZTFaf30Mf1XWd8cmflZQ8YLXACBcMCk4vSbHZ+2LRtfz9OBdCmdM AWb3w/Pm/mUqOe7PSM70cQW6TL8skSeWh8zyVPXCdeEONi+zOESasNqxq9FUqA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1622721331; a=rsa-sha256; cv=none; b=WyCrBWSqaz4kB6w4pANGzBOqv5NLlNVgJuzhG8dpOMReKV3G4c7AP4zUFp+T0NbIlAKQZl kUr3+czcB3aGMi02p6Z+s6l9JXBKe0U6Pk5pySw5S/Ink6TTfztqudXsuEQp4PKR1NFIZC e341AvUAVl6sb0W7IOmu7F8hu6DQ2BZcjiwJdFP79hc7GfmEoUitSAtWkglqU1EHE1BrGK k6Pp21Z34msvifVfnwlFt5VRR0R2D1VxpEBCZWPBu3zsL9TCflTZ9NuQo6BM+i3h9RX6Vl D1HK5jfzFDWdP/f4M09CFrKyn/I7jNXS18Gy7jtmMxlxcgAhjLNHJujFVuo9Cg== 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: C4E3D25B5F X-Spam-Score: -1.02 X-Migadu-Scanner: scn0.migadu.com X-TUID: heDeCeBlElGu 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