From: David Bremner <david@tethera.net>
To: notmuch@notmuchmail.org
Cc: David Bremner <david@tethera.net>
Subject: [PATCH 2/3] emacs/show: add parameter notmuch-show-single-message
Date: Thu, 3 Jun 2021 08:54:59 -0300 [thread overview]
Message-ID: <20210603115500.987504-3-david@tethera.net> (raw)
In-Reply-To: <20210603115500.987504-1-david@tethera.net>
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
next prev parent reply other threads:[~2021-06-03 11:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-03 11:54 Handle long threads in unthreaded-view David Bremner
2021-06-03 11:54 ` [PATCH 1/3] test: start test file for emacs unthreaded view David Bremner
2021-06-03 11:54 ` David Bremner [this message]
2021-06-03 11:55 ` [PATCH 3/3] emacs/tree use notmuch-show-single-message David Bremner
[not found] <20210626120428.153445-1-david@tethera.net>
2021-06-26 12:04 ` [PATCH 2/3] emacs/show: add parameter notmuch-show-single-message David Bremner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210603115500.987504-3-david@tethera.net \
--to=david@tethera.net \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).