Subject: Re: bug#53755: 27.2; C-u M-x gnus-summary-sort-by-most-recent-number / -date not ordering threads as expected

From: Emilia Blåsten <[email-masked]>
Date: Sat, 05 Feb 2022 01:11:00 +0200

Dear all,

Thank you for the quick replies. My bug report seems indeed about the
same issues as in bugs #18156 and #42334 reported by Michael Welsh
Duggan and Kévin Le Gouguec earlier.

Lars Ingebrigtsen <[email-masked]> writes:

> It's hard to say since the display is so non-standard, but
> is the issue that the gathered threads aren't sorted as expected?  If
> so, see `gnus-sort-gathered-threads-function'.

Arash Esbati <[email-masked]> writes:

> My apologies if I didn't understand your requirements correctly, but I
> think you're looking for `gnus-subthread-sort-functions'.  Try
>
> (setq (gnus-thread-sort-functions
>        '(gnus-thread-sort-by-most-recent-number))
>       (gnus-subthread-sort-functions
>        '(gnus-thread-sort-by-date)))

Thank you. I will look into these, and I believe they can help me solve
problem 2) in my original email.

Michael Welsh Duggan <[email-masked]> writes:

> This may be related to Bug #18156.
>
> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=18156
>
> I have patched my local gnus to allow sorting threads by newest message.

Kévin Le Gouguec <[email-masked]> writes:

> Michael Welsh Duggan <[email-masked]> writes:
>>                                                                     Here
>> is my use case:  I want to sort the threads in my summary buffer,
>> post-gathering, by the date of the most recent article in the thread.
>> If threads (not the articles in threads) are sorted before they are
>> gathered, this seems less than possible.
>
> I think I filed more or less the same bug (bug#42334), with more or less
> the same conclusion?
>
> Lars suggested a solution before wontfixing it, but I never got around
> to implementing it.  How does your local patch work?

Michael Welsh Duggan <[email-masked]> writes:

> I run with the included patch.  In the group for which I care about
> this, I set the following group parameter:
>
>   (gnus-thread-sort-functions
>      'md5i-thread-sort-by-most-recent-date-reverse)
>
> where `md5i-thread-sort-by-most-recent-date-reverse' is defined thusly:
>
>     (defun md5i-thread-sort-by-most-recent-date-reverse (h1 h2)
>       (<= (gnus-thread-latest-date h1) (gnus-thread-latest-date h2)))

This seems to be it! I have not given a try to the patch yet, but I am
quite certain this is the same issue. Kévin's description (bug #42334)
matches my issue very well. Since this part of the code is very old, I
do understand that you would hesitate changing it, in which case this
can be closed from my part. I guess I didn't find these because I was
looking only at unarchived issues in debbugs.gnu.org.

Best regards,
Emilia