Re: notmuch.el question: reading all messages in thread

2024-05-26 Thread David Bremner
Matt Armstrong  writes:

> Sometimes a notmuch query matches only a subset of messages in a thread.
> When this happens only that subset of messages will be "open".  Many
> notmuch commands operate on the "open" messages only.  For example: SPC,
> 'n', 'p'.
>
> Often this is what I want.  It works well when I'm looking for a
> specific piece of information, or when I am interested in reading only
> the unread messages in a long thread that I have seen previously.
>
> Often this is not what I want.  I'm interested in seeing all messages
> when I am looking for entire conversations where a topic is being
> discussed.  E.g. when I want to re-read a long forgotten thread, or one
> that surfaced through specific search terms that appear only in a few of
> the messages in the thread.

In notmuch-show mode, M- opens all messages. 

> 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?

Not exactly an answer, but maybe this helps someone:

In tree-mode I would suggest using "N" and "P" to ignore the open/closed
status of a message. Or just move using the arrow keys / mouse and hit
return on the message you want to read.

If you really rarely want to the "*-matching-message" versions, then you
could swap the bindings
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: notmuch.el question: reading all messages in thread

2022-11-22 Thread Kyle Meyer
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---
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


notmuch.el question: reading all messages in thread

2022-11-22 Thread Matt Armstrong
Sometimes a notmuch query matches only a subset of messages in a thread.
When this happens only that subset of messages will be "open".  Many
notmuch commands operate on the "open" messages only.  For example: SPC,
'n', 'p'.

Often this is what I want.  It works well when I'm looking for a
specific piece of information, or when I am interested in reading only
the unread messages in a long thread that I have seen previously.

Often this is not what I want.  I'm interested in seeing all messages
when I am looking for entire conversations where a topic is being
discussed.  E.g. when I want to re-read a long forgotten thread, or one
that surfaced through specific search terms that appear only in a few of
the messages in the thread.

For example, I subscribe to some lists but don't read all messages in a
timely manner, if I ever read them at all.  A search might surface
threads from those lists before I read them with my usual "tag:inbox
tag:somelist" query.  I typically find these threads with a query
"tag:inbox some other search term".

In the second case I can achieve what I want with queries like:

  thread:"{tag:inbox some other search term}"

But this is a burden to type and I often realize I want this after the
usual query has produced the search results, and then pressed 'Z' to get
a tree view, and realized that most of the messages are "closed."

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 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.
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org