From: Kyle Meyer <kyle@kyleam.com>
To: Matt Armstrong <matt@rfc20.org>
Cc: notmuch@notmuchmail.org
Subject: Re: notmuch.el question: reading all messages in thread
Date: Tue, 22 Nov 2022 13:29:42 -0500 [thread overview]
Message-ID: <87edtu971l.fsf@kyleam.com> (raw)
In-Reply-To: <87bkoyc32t.fsf@rfc20.org>
Matt Armstrong writes:
[...]
> I looked for a way to easily re-query a tree view buffer such that all
> messages in all threads shown are "open" but did not find it. Does this
> exist?
I've wanted something like this too and will be happy if someone points
out an existing way to do it. I'm not aware of one.
> I suppose I'm looking for the opposite of `notmuch-tree-filter'. Maybe
> `notmuch-tree-widen-to-thread' that produces a new notmuch tree widened
> to the entire thread of the current message.
In show buffers, I remap notmuch-tree-from-show-current-query to a
custom function. Like the original variant, it displays the tree for a
message's thread, but giving a prefix argument says to display all the
messages as "open".
I don't think that's exactly what you're asking for, but it still might
be useful (at least for adapting to something that behaves as you want).
--8<---------------cut here---------------start------------->8---
(defun km/notmuch-thread-id-from-message-id (message-id)
(let ((threads (with-temp-buffer
(call-process "notmuch" nil t nil
"search" "--format=sexp" "--output=threads"
message-id)
(goto-char (point-min))
(read (current-buffer)))))
(cl-case (length threads)
(0
(user-error "No thread found for %S" message-id))
(1
(concat "thread:" (car threads)))
(t
(error "Got multiple threads for %S" message-id)))))
;;;###autoload
(defun km/notmuch-tree-from-show-current-query (&optional ignore-context)
(interactive "P")
(let* ((mid (or (notmuch-show-get-message-id)
(error "No message ID found")))
(tid (if (and notmuch-show-thread-id
;; notmuch's variant works with
;; notmuch-show-thread-id ...
(string-prefix-p "thread:" notmuch-show-thread-id))
notmuch-show-thread-id
;; ... but there are cases where this is set to the
;; message ID, leading to the tree result that is
;; always narrowed to the message. Try harder to get
;; the actual thread ID.
(km/notmuch-thread-id-from-message-id mid)))
(notmuch-show-query-context (and (not ignore-context)
notmuch-show-query-context)))
(notmuch-tree tid notmuch-show-query-context mid)))
--8<---------------cut here---------------end--------------->8---
prev parent reply other threads:[~2022-11-22 18:38 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-22 17:27 notmuch.el question: reading all messages in thread Matt Armstrong
2022-11-22 18:29 ` Kyle Meyer [this message]
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=87edtu971l.fsf@kyleam.com \
--to=kyle@kyleam.com \
--cc=matt@rfc20.org \
--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).