Re: [PATCH 2/2] Add notmuch-search-show-or-unthread

Subject: Re: [PATCH 2/2] Add notmuch-search-show-or-unthread

Date: Thu, 25 Jul 2024 20:32:23 +0900

To: Sandra Snan, notmuch@notmuchmail.org

Cc: Sandra Snan

From: David Bremner


Sandra Snan <sandra.snan@idiomdrottning.org> writes:
>
> It shells out to notmuch count to see if the thread is big or small.
> "Big" is hardcoded to ten messages or lower, if we want to introduce a
> variable for that instead, that might be great.

Yes, I think a defcustom is called for.

>
> It's a deliberate choice to count all the messages in the thread, not
> just ones that are part of the search (a.k.a. the ones that will show
> up in the unthreaded view if the thread is big). The reason for that
> is that that's the number that matters when it comes to how well
> `notmuch-search-show-thread` can handle it. That's by design. So if
> there's a thread with 100000 messages and four of them show up in the
> search (maybe because they have a particular tag or date), it'll see
> that the thread is big and "explode" it and then show those four new
> messages in a flat view.

Some of that explanation can maybe go in the docstring of the newly
defined customize variable
>  
> +(defun notmuch-search-show-or-unthread ()
> +  "If the thread is small, show it the normal notmuch way, and if
> +it's big, show the messages separatley in a buffer so you can
> +visit them individually."
> +  (interactive)
> +  (let ((thread-id (notmuch-search-find-thread-id)))
> +    (if thread-id
> +	(if (< 11 (notmuch-call-notmuch-sexp "count" thread-id))
> +	    (notmuch-search-unthread-thread)
> +	    (notmuch-search-show-thread))
emacs wants to indent this line differently, so please follow its lead here.

> +      (message "No such thread with that id found!")
> +      nil)))

I guess we should think about a default binding for this. One option is
to replace the default notmuch-search-show-thread binding, and just set
the threshhold very high so that most users will not notice the
change. There is a slight performance penalty from add notmuch count;
I'm not sure if this is noticable. 
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: