all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Sorting with threads in Gnus
@ 2013-07-23  8:49 N. Raghavendra
  2013-07-24  6:21 ` Eric Abrahamsen
  0 siblings, 1 reply; 31+ messages in thread
From: N. Raghavendra @ 2013-07-23  8:49 UTC (permalink / raw)
  To: help-gnu-emacs

I have

(setq gnus-thread-sort-functions
     '(gnus-thread-sort-by-number (not gnus-thread-sort-by-date)))

in my Gnus init file.  This sorts threads the way I want --- decreasing
order of dates, latest to earliest.  However, it seems to sort messages
within a thread also in decreasing order of date, as in this example
from the gmane.emacs.help group:

01 2013-07-07 02:48   Chris Seberino         > Trouble binding Alt ...
02 2013-07-07 10:38   Chris Seberino         |-> 
03 2013-07-07 18:21   Pascal J. Bourguigno   | |-> 
04 2013-07-08 02:20   Chris Seberino         | | \-> 
05 2013-07-08 03:36   Pascal J. Bourguigno   | |   \-> 
06 2013-07-07 17:54   Raffaele Ricciardi     | |-> 
07 2013-07-07 09:19   Yuri Khan              |-> 
08 2013-07-07 08:14   Bob Proulx             |-> 
09 2013-07-07 03:51   Peter Dyballa          |-> 
10 2013-07-07 03:46   Pascal J. Bourguigno   |-> 

I want the messages in the thread and each subthread to be sorted in
increasing order of date, like this:

01 2013-07-07 02:48   Chris Seberino         > Trouble binding Alt ...
10 2013-07-07 03:46   Pascal J. Bourguigno   |-> 
09 2013-07-07 03:51   Peter Dyballa          |-> 
08 2013-07-07 08:14   Bob Proulx             |-> 
07 2013-07-07 09:19   Yuri Khan              |-> 
02 2013-07-07 10:38   Chris Seberino         \-> 
06 2013-07-07 17:54   Raffaele Ricciardi       |-> 
03 2013-07-07 18:21   Pascal J. Bourguigno     \-> 
04 2013-07-08 02:20   Chris Seberino             \-> 
05 2013-07-08 03:36   Pascal J. Bourguigno         \-> 

This is the way it is on the Gmane page of the thread at
http://thread.gmane.org/gmane.emacs.help/91990 (with the time zone 3.5
hours behind the time zone above).  Is there a way to get this
Gmane-like order (main threads decreasing, all subthreads increasing) in
Gnus?

Thanks and best regards,
Raghavendra.

PS: I posted this to the gmane.emacs.gnus.user mailing list several days
ago, with no response.  I am posting this here in case some one here has
suggestions.

-- 
N. Raghavendra <raghu@hri.res.in>, http://www.retrotexts.net/
Harish-Chandra Research Institute, http://www.hri.res.in/




^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Sorting with threads in Gnus
  2013-07-23  8:49 Sorting with threads in Gnus N. Raghavendra
@ 2013-07-24  6:21 ` Eric Abrahamsen
  2013-07-24  8:17   ` N. Raghavendra
  2013-07-24 13:15   ` Tassilo Horn
  0 siblings, 2 replies; 31+ messages in thread
From: Eric Abrahamsen @ 2013-07-24  6:21 UTC (permalink / raw)
  To: help-gnu-emacs

"N. Raghavendra" <raghu@hri.res.in> writes:

> I have
>
> (setq gnus-thread-sort-functions
>      '(gnus-thread-sort-by-number (not gnus-thread-sort-by-date)))

Maybe look at `gnus-sort-gathered-threads-function? Here's what I use:

(setq gnus-thread-sort-functions '(gnus-thread-sort-by-number
				   gnus-thread-sort-by-most-recent-date)
      gnus-sort-gathered-threads-function 'gnus-thread-sort-by-date)

HTH,
Eric

> in my Gnus init file.  This sorts threads the way I want --- decreasing
> order of dates, latest to earliest.  However, it seems to sort messages
> within a thread also in decreasing order of date, as in this example
> from the gmane.emacs.help group:
>
> 01 2013-07-07 02:48   Chris Seberino         > Trouble binding Alt ...
> 02 2013-07-07 10:38   Chris Seberino         |-> 
> 03 2013-07-07 18:21   Pascal J. Bourguigno   | |-> 
> 04 2013-07-08 02:20   Chris Seberino         | | \-> 
> 05 2013-07-08 03:36   Pascal J. Bourguigno   | |   \-> 
> 06 2013-07-07 17:54   Raffaele Ricciardi     | |-> 
> 07 2013-07-07 09:19   Yuri Khan              |-> 
> 08 2013-07-07 08:14   Bob Proulx             |-> 
> 09 2013-07-07 03:51   Peter Dyballa          |-> 
> 10 2013-07-07 03:46   Pascal J. Bourguigno   |-> 
>
> I want the messages in the thread and each subthread to be sorted in
> increasing order of date, like this:
>
> 01 2013-07-07 02:48   Chris Seberino         > Trouble binding Alt ...
> 10 2013-07-07 03:46   Pascal J. Bourguigno   |-> 
> 09 2013-07-07 03:51   Peter Dyballa          |-> 
> 08 2013-07-07 08:14   Bob Proulx             |-> 
> 07 2013-07-07 09:19   Yuri Khan              |-> 
> 02 2013-07-07 10:38   Chris Seberino         \-> 
> 06 2013-07-07 17:54   Raffaele Ricciardi       |-> 
> 03 2013-07-07 18:21   Pascal J. Bourguigno     \-> 
> 04 2013-07-08 02:20   Chris Seberino             \-> 
> 05 2013-07-08 03:36   Pascal J. Bourguigno         \-> 
>
> This is the way it is on the Gmane page of the thread at
> http://thread.gmane.org/gmane.emacs.help/91990 (with the time zone 3.5
> hours behind the time zone above).  Is there a way to get this
> Gmane-like order (main threads decreasing, all subthreads increasing) in
> Gnus?
>
> Thanks and best regards,
> Raghavendra.
>
> PS: I posted this to the gmane.emacs.gnus.user mailing list several days
> ago, with no response.  I am posting this here in case some one here has
> suggestions.




^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Sorting with threads in Gnus
  2013-07-24  6:21 ` Eric Abrahamsen
@ 2013-07-24  8:17   ` N. Raghavendra
  2013-07-24 13:15   ` Tassilo Horn
  1 sibling, 0 replies; 31+ messages in thread
From: N. Raghavendra @ 2013-07-24  8:17 UTC (permalink / raw)
  To: help-gnu-emacs

At 2013-07-24T14:21:02+08:00, Eric Abrahamsen wrote:

> "N. Raghavendra" <raghu@hri.res.in> writes:
>
>> I have
>>
>> (setq gnus-thread-sort-functions
>>      '(gnus-thread-sort-by-number (not gnus-thread-sort-by-date)))
>
> Maybe look at `gnus-sort-gathered-threads-function? Here's what I use:
>
> (setq gnus-thread-sort-functions '(gnus-thread-sort-by-number
> 				   gnus-thread-sort-by-most-recent-date)
>       gnus-sort-gathered-threads-function 'gnus-thread-sort-by-date)

Thanks.  I tried

(setq gnus-thread-sort-functions
      '(gnus-thread-sort-by-number (not gnus-thread-sort-by-date)))

(setq gnus-sort-gathered-threads-function 'gnus-thread-sort-by-date)

but it gives the same sorting within threads as before.

Best regards,
Raghavendra.

-- 
N. Raghavendra <raghu@hri.res.in>, http://www.retrotexts.net/
Harish-Chandra Research Institute, http://www.hri.res.in/




^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Sorting with threads in Gnus
  2013-07-24  6:21 ` Eric Abrahamsen
  2013-07-24  8:17   ` N. Raghavendra
@ 2013-07-24 13:15   ` Tassilo Horn
  2013-07-26  4:37     ` Eric Abrahamsen
  1 sibling, 1 reply; 31+ messages in thread
From: Tassilo Horn @ 2013-07-24 13:15 UTC (permalink / raw)
  To: help-gnu-emacs

Eric Abrahamsen <eric@ericabrahamsen.net> writes:

Hi Eric,

> Maybe look at `gnus-sort-gathered-threads-function? Here's what I use:
>
> (setq gnus-thread-sort-functions '(gnus-thread-sort-by-number
> 				   gnus-thread-sort-by-most-recent-date)
>       gnus-sort-gathered-threads-function 'gnus-thread-sort-by-date)

Oh, I didn't know that variable.  But it still doesn't really help me.
What works is

--8<---------------cut here---------------start------------->8---
(setq gnus-thread-sort-functions
      '(gnus-thread-sort-by-number
        gnus-thread-sort-by-date)
      gnus-sort-gathered-threads-function 'gnus-thread-sort-by-date)
--8<---------------cut here---------------end--------------->8---

which sorts threads and subthreads/articles of threads from old to new.

Hovever, I'd prefer to sort thread roots first by total score, then by
most recent article in the thread, so that at the top of the summary,
there's the thread with the highest total score, and if two threads have
the same total score, the one with the most recent article is on top.

However, as soon as I add `gnus-thread-sort-by-total-score' and
`gnus-thread-sort-by-most-recent-date' to `gnus-thread-sort-functions',
the sorting inside threads goes wonky as well...

Bye,
Tassilo




^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Sorting with threads in Gnus
  2013-07-24 13:15   ` Tassilo Horn
@ 2013-07-26  4:37     ` Eric Abrahamsen
  2013-07-26  5:48       ` Tassilo Horn
  0 siblings, 1 reply; 31+ messages in thread
From: Eric Abrahamsen @ 2013-07-26  4:37 UTC (permalink / raw)
  To: help-gnu-emacs

Tassilo Horn <tsdh@gnu.org> writes:

> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>
> Hi Eric,
>
>> Maybe look at `gnus-sort-gathered-threads-function? Here's what I use:
>>
>> (setq gnus-thread-sort-functions '(gnus-thread-sort-by-number
>> 				   gnus-thread-sort-by-most-recent-date)
>>       gnus-sort-gathered-threads-function 'gnus-thread-sort-by-date)
>
> Oh, I didn't know that variable.  But it still doesn't really help me.
> What works is
>
> (setq gnus-thread-sort-functions
>       '(gnus-thread-sort-by-number
>         gnus-thread-sort-by-date)
>       gnus-sort-gathered-threads-function 'gnus-thread-sort-by-date)
>
> which sorts threads and subthreads/articles of threads from old to new.
>
> Hovever, I'd prefer to sort thread roots first by total score, then by
> most recent article in the thread, so that at the top of the summary,
> there's the thread with the highest total score, and if two threads have
> the same total score, the one with the most recent article is on top.
>
> However, as soon as I add `gnus-thread-sort-by-total-score' and
> `gnus-thread-sort-by-most-recent-date' to `gnus-thread-sort-functions',
> the sorting inside threads goes wonky as well...

I doubt I'll be able to help -- I don't use scoring, and most of my gnus
configurations seem to involve some degree of magical thinking.

Just for clarity, your desired setup, that goes "wonky", would look like
this:

(setq gnus-thread-sort-functions
      '(gnus-thread-sort-by-total-score
        gnus-thread-sort-by-most-recent-date)
      gnus-sort-gathered-threads-function
      'gnus-thread-sort-by-date)

Is that right? So it's the 'gnus-thread-sort-by-date effect inside the
threads themselves that's going wrong? Wonky how?

E




^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Sorting with threads in Gnus
  2013-07-26  4:37     ` Eric Abrahamsen
@ 2013-07-26  5:48       ` Tassilo Horn
  2013-07-26  9:01         ` Eric Abrahamsen
  0 siblings, 1 reply; 31+ messages in thread
From: Tassilo Horn @ 2013-07-26  5:48 UTC (permalink / raw)
  To: help-gnu-emacs

Eric Abrahamsen <eric@ericabrahamsen.net> writes:

Hi Eric,

>> However, as soon as I add `gnus-thread-sort-by-total-score' and
>> `gnus-thread-sort-by-most-recent-date' to
>> `gnus-thread-sort-functions', the sorting inside threads goes wonky
>> as well...
>
> I doubt I'll be able to help -- I don't use scoring, and most of my gnus
> configurations seem to involve some degree of magical thinking.
>
> Just for clarity, your desired setup, that goes "wonky", would look like
> this:
>
> (setq gnus-thread-sort-functions
>       '(gnus-thread-sort-by-total-score
>         gnus-thread-sort-by-most-recent-date)
>       gnus-sort-gathered-threads-function
>       'gnus-thread-sort-by-date)
>
> Is that right?

Not quite.  I think that would be my perfect setup:

--8<---------------cut here---------------start------------->8---
(setq gnus-thread-sort-functions
      '(gnus-thread-sort-by-number
        gnus-thread-sort-by-date
	gnus-thread-sort-by-most-recent-date
        gnus-thread-sort-by-total-score)
      gnus-sort-gathered-threads-function 'gnus-thread-sort-by-date)
--8<---------------cut here---------------end--------------->8---

> So it's the 'gnus-thread-sort-by-date effect inside the threads
> themselves that's going wrong? Wonky how?

I don't really see its effect.  With
`gnus-sort-gathered-threads-function' set to the default value
`gnus-thread-sort-by-number' I get the same sorting order.

The problem is that Gnus seems to sort threads and also subthreads with
`gnus-thread-sort-functions'.  So in my case, high-score subthreads will
come before low-score subthreads, and when the score is equal,
subthreads with more recent articles will come before subthreads with
older recent articles.  But inside threads, I want sorting to be
strictly chronological from old to new.

For example, below Y should be before the subthread X, because it's
older.

--8<---------------cut here---------------start------------->8---
O ┃  ┃Juanma Barranquero     ┃ ╭●  frame size&position woes <Jul 21 2013 14:56>
O ┃  ┃martin rudalics        ┃ ├──❯   <Jul 21 2013 16:03>               ;; X
O ┃  ┃Juanma Barranquero     ┃ │╰──❯   <Jul 21 2013 17:42>
O ┃  ┃martin rudalics        ┃ │ ├──❯   <Jul 22 2013 10:22>
O ┃  ┃Juanma Barranquero     ┃ │ │╰──❯   <Jul 22 2013 11:40>
O ┃  ┃Eli Zaretskii          ┃ │ │ ╰──❯   <Jul 22 2013 17:52>
O ┃  ┃Juanma Barranquero     ┃ │ │  ╰──❯   <Jul 22 2013 22:36>
O ┃  ┃Eli Zaretskii          ┃ │ │   ╰──❯   <Jul 23 2013 04:45>
O ┃  ┃Juanma Barranquero     ┃ │ │    ╰──❯   <Jul 24 2013 01:47>
O ┃  ┃Eli Zaretskii          ┃ │ │     ╰──❯   <Jul 24 2013 05:55>
O ┃  ┃Juanma Barranquero     ┃ │ │      ╰──❯   <Jul 24 2013 12:42>
O ┃  ┃Eli Zaretskii          ┃ │ │       ╰──❯   <Jul 24 2013 16:37>
O ┃  ┃Juanma Barranquero     ┃ │ │        ╰──❯   <Jul 24 2013 16:51>
O ┃  ┃Eli Zaretskii          ┃ │ │         ╰──❯   <Jul 24 2013 18:55>
O ┃  ┃Juanma Barranquero     ┃ │ │          ╰──❯   <Jul 24 2013 19:01>
O ┃  ┃Eli Zaretskii          ┃ │ │           ╰──❯   <Jul 24 2013 19:41>
O ┃  ┃Juanma Barranquero     ┃ │ │            ╰──❯   <Jul 24 2013 19:49>
O ┃  ┃Juanma Barranquero     ┃ │ ╰──❯   <Jul 21 2013 17:58>
O ┃  ┃Juanma Barranquero     ┃ ╰──❯   <Jul 21 2013 14:58>               ;; Y
--8<---------------cut here---------------end--------------->8---

I hoped that `gnus-thread-sort-functions' was applied only to thread
roots, and `gnus-sort-gathered-threads-function' to subthreads, but that
doesn't seem to be tha case.

Bye,
Tassilo




^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Sorting with threads in Gnus
  2013-07-26  5:48       ` Tassilo Horn
@ 2013-07-26  9:01         ` Eric Abrahamsen
  2013-07-26 13:06           ` Tassilo Horn
  0 siblings, 1 reply; 31+ messages in thread
From: Eric Abrahamsen @ 2013-07-26  9:01 UTC (permalink / raw)
  To: help-gnu-emacs

Tassilo Horn <tsdh@gnu.org> writes:

> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>
> Hi Eric,
>
>>> However, as soon as I add `gnus-thread-sort-by-total-score' and
>>> `gnus-thread-sort-by-most-recent-date' to
>>> `gnus-thread-sort-functions', the sorting inside threads goes wonky
>>> as well...
>>
>> I doubt I'll be able to help -- I don't use scoring, and most of my gnus
>> configurations seem to involve some degree of magical thinking.
>>
>> Just for clarity, your desired setup, that goes "wonky", would look like
>> this:
>>
>> (setq gnus-thread-sort-functions
>>       '(gnus-thread-sort-by-total-score
>>         gnus-thread-sort-by-most-recent-date)
>>       gnus-sort-gathered-threads-function
>>       'gnus-thread-sort-by-date)
>>
>> Is that right?
>
> Not quite.  I think that would be my perfect setup:
>
> (setq gnus-thread-sort-functions
>       '(gnus-thread-sort-by-number
>         gnus-thread-sort-by-date
> 	gnus-thread-sort-by-most-recent-date
>         gnus-thread-sort-by-total-score)
>       gnus-sort-gathered-threads-function 'gnus-thread-sort-by-date)
>
>> So it's the 'gnus-thread-sort-by-date effect inside the threads
>> themselves that's going wrong? Wonky how?
>
> I don't really see its effect.  With
> `gnus-sort-gathered-threads-function' set to the default value
> `gnus-thread-sort-by-number' I get the same sorting order.
>
> The problem is that Gnus seems to sort threads and also subthreads with
> `gnus-thread-sort-functions'.  So in my case, high-score subthreads will
> come before low-score subthreads, and when the score is equal,
> subthreads with more recent articles will come before subthreads with
> older recent articles.  But inside threads, I want sorting to be
> strictly chronological from old to new.
>
> For example, below Y should be before the subthread X, because it's
> older.
>
> O ┃  ┃Juanma Barranquero     ┃ ╭●  frame size&position woes <Jul 21 2013 14:56>
> O ┃  ┃martin rudalics        ┃ ├──❯   <Jul 21 2013 16:03>               ;; X
> O ┃  ┃Juanma Barranquero     ┃ │╰──❯   <Jul 21 2013 17:42>
> O ┃  ┃martin rudalics        ┃ │ ├──❯   <Jul 22 2013 10:22>
> O ┃  ┃Juanma Barranquero     ┃ │ │╰──❯   <Jul 22 2013 11:40>
> O ┃  ┃Eli Zaretskii          ┃ │ │ ╰──❯   <Jul 22 2013 17:52>
> O ┃  ┃Juanma Barranquero     ┃ │ │  ╰──❯   <Jul 22 2013 22:36>
> O ┃  ┃Eli Zaretskii          ┃ │ │   ╰──❯   <Jul 23 2013 04:45>
> O ┃  ┃Juanma Barranquero     ┃ │ │    ╰──❯   <Jul 24 2013 01:47>
> O ┃  ┃Eli Zaretskii          ┃ │ │     ╰──❯   <Jul 24 2013 05:55>
> O ┃  ┃Juanma Barranquero     ┃ │ │      ╰──❯   <Jul 24 2013 12:42>
> O ┃  ┃Eli Zaretskii          ┃ │ │       ╰──❯   <Jul 24 2013 16:37>
> O ┃  ┃Juanma Barranquero     ┃ │ │        ╰──❯   <Jul 24 2013 16:51>
> O ┃  ┃Eli Zaretskii          ┃ │ │         ╰──❯   <Jul 24 2013 18:55>
> O ┃  ┃Juanma Barranquero     ┃ │ │          ╰──❯   <Jul 24 2013 19:01>
> O ┃  ┃Eli Zaretskii          ┃ │ │           ╰──❯   <Jul 24 2013 19:41>
> O ┃  ┃Juanma Barranquero     ┃ │ │            ╰──❯   <Jul 24 2013 19:49>
> O ┃  ┃Juanma Barranquero     ┃ │ ╰──❯   <Jul 21 2013 17:58>
> O ┃  ┃Juanma Barranquero     ┃ ╰──❯   <Jul 21 2013 14:58>               ;; Y
>
> I hoped that `gnus-thread-sort-functions' was applied only to thread
> roots, and `gnus-sort-gathered-threads-function' to subthreads, but that
> doesn't seem to be tha case.

Huh, interesting -- I hadn't realized subthreads were sorted as well,
but they are: gnus-sort-threads calls the appropriately-named
gnus-sort-threads-recursive.

That's hard-coded, and there's nothing to distinguish a top-level thread
from a subthread. But I'll bet with a little care, it would be possible
to make a gnus-sort-threads-recursively-p option, which would have
gnus-sort-threads break to gnus-sort-articles after the first round of
sorting... Maybe.

Eric




^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Sorting with threads in Gnus
  2013-07-26  9:01         ` Eric Abrahamsen
@ 2013-07-26 13:06           ` Tassilo Horn
  2013-07-26 13:26             ` Tassilo Horn
  0 siblings, 1 reply; 31+ messages in thread
From: Tassilo Horn @ 2013-07-26 13:06 UTC (permalink / raw)
  To: help-gnu-emacs

Eric Abrahamsen <eric@ericabrahamsen.net> writes:

>> I hoped that `gnus-thread-sort-functions' was applied only to thread
>> roots, and `gnus-sort-gathered-threads-function' to subthreads, but
>> that doesn't seem to be tha case.
>
> Huh, interesting -- I hadn't realized subthreads were sorted as well,
> but they are: gnus-sort-threads calls the appropriately-named
> gnus-sort-threads-recursive.

Funnily, I also didn't notice that for years.  But now that I do, it
started annoying me.

> That's hard-coded, and there's nothing to distinguish a top-level
> thread from a subthread.

Well, I'd say a thread root doesn't really need to be the real root of a
thread, just the top-level article that's displayed by Gnus in the
summary buffer (which depends on `gnus-fetch-old-headers' and others).
And I guess that's identitfiable, e.g., the articles that get their
summary thread tree style from `gnus-sum-thread-tree-root',
`gnus-sum-thread-tree-false-root', and
`gnus-sum-thread-tree-single-indent' are the root articles of a thread.

> But I'll bet with a little care, it would be possible to make a
> gnus-sort-threads-recursively-p option, which would have
> gnus-sort-threads break to gnus-sort-articles after the first round of
> sorting... Maybe.

That would be awesome.

Bye,
Tassilo




^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Sorting with threads in Gnus
  2013-07-26 13:06           ` Tassilo Horn
@ 2013-07-26 13:26             ` Tassilo Horn
  2013-07-26 13:43               ` Tassilo Horn
  0 siblings, 1 reply; 31+ messages in thread
From: Tassilo Horn @ 2013-07-26 13:26 UTC (permalink / raw)
  To: help-gnu-emacs

Tassilo Horn <tsdh@gnu.org> writes:

>> But I'll bet with a little care, it would be possible to make a
>> gnus-sort-threads-recursively-p option, which would have
>> gnus-sort-threads break to gnus-sort-articles after the first round
>> of sorting... Maybe.
>
> That would be awesome.

That was easier than expected.  The following patch (with setting
gnus-sort-threads-recursively to nil) seems to achieve exactly what I
want.

--8<---------------cut here---------------start------------->8---
diff --git a/lisp/gnus-sum.el b/lisp/gnus-sum.el
index f3918b0..15cbb5a 100644
--- a/lisp/gnus-sum.el
+++ b/lisp/gnus-sum.el
@@ -847,6 +847,13 @@ controls how articles are sorted."
                           (function :tag "other"))
                   (boolean :tag "Reverse order"))))
 
+(defcustom gnus-sort-threads-recursively t
+  "If non-nil, `gnus-thread-sort-functions' are applied recursively.
+Setting this to nil allows sorting high-score, recent,
+etc. threads to the top of the summary buffer while still
+retaining chronological old to new sorting order inside threads."
+  :group 'gnus-summary-sort
+  :type 'boolean)
 
 (defcustom gnus-thread-sort-functions '(gnus-thread-sort-by-number)
   "*List of functions used for sorting threads in the summary buffer.
@@ -4876,9 +4883,11 @@ If LINE, insert the rebuilt thread starting on line LINE."
     (gnus-message 8 "Sorting threads...")
     (prog1
 	(condition-case nil
-	    (let ((max-lisp-eval-depth (max max-lisp-eval-depth 5000)))
-	      (gnus-sort-threads-recursive
-	       threads (gnus-make-sort-function gnus-thread-sort-functions)))
+	    (let ((max-lisp-eval-depth (max max-lisp-eval-depth 5000))
+		  (sort-func (gnus-make-sort-function gnus-thread-sort-functions)))
+	      (if gnus-sort-threads-recursively
+		  (gnus-sort-threads-recursive threads sort-func)
+		(sort threads sort-func)))
 	  ;; Even after binding max-lisp-eval-depth, the recursive
 	  ;; sorter might fail for very long threads.  In that case,
 	  ;; try using a (less well-tested) non-recursive sorter.
--8<---------------cut here---------------end--------------->8---

It would be good if others could test-drive it a bit more.  If it
doesn't break anything, I'm going to add some docs and commit it in the
Gnus master branch.

Bye,
Tassilo




^ permalink raw reply related	[flat|nested] 31+ messages in thread

* Re: Sorting with threads in Gnus
  2013-07-26 13:26             ` Tassilo Horn
@ 2013-07-26 13:43               ` Tassilo Horn
  2013-07-26 15:26                 ` Eric Abrahamsen
  2013-07-26 17:40                 ` N. Raghavendra
  0 siblings, 2 replies; 31+ messages in thread
From: Tassilo Horn @ 2013-07-26 13:43 UTC (permalink / raw)
  To: help-gnu-emacs; +Cc: N. Raghavendra

Tassilo Horn <tsdh@gnu.org> writes:

> It would be good if others could test-drive it a bit more.  If it
> doesn't break anything, I'm going to add some docs and commit it in
> the Gnus master branch.

Ah, it looks to easy to be able to break anything, so I've just pushed
it out. ;-)

Raghavendra, could you try running the Git version of Gnus and setting

  (setq gnus-sort-threads-recursively nil
        gnus-thread-sort-functions
        '(gnus-thread-sort-by-number
          (not gnus-thread-sort-by-date)))

That should give you the sorting order you want, i.e., new threads at
the top, old threads at the bottom, but inside threads from old to new.

Bye,
Tassilo




^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Sorting with threads in Gnus
  2013-07-26 13:43               ` Tassilo Horn
@ 2013-07-26 15:26                 ` Eric Abrahamsen
  2013-07-26 16:56                   ` Tassilo Horn
  2013-07-26 17:40                 ` N. Raghavendra
  1 sibling, 1 reply; 31+ messages in thread
From: Eric Abrahamsen @ 2013-07-26 15:26 UTC (permalink / raw)
  To: help-gnu-emacs

Tassilo Horn <tsdh@gnu.org> writes:

> Tassilo Horn <tsdh@gnu.org> writes:
>
>> It would be good if others could test-drive it a bit more.  If it
>> doesn't break anything, I'm going to add some docs and commit it in
>> the Gnus master branch.
>
> Ah, it looks to easy to be able to break anything, so I've just pushed
> it out. ;-)
>
> Raghavendra, could you try running the Git version of Gnus and setting
>
>   (setq gnus-sort-threads-recursively nil
>         gnus-thread-sort-functions
>         '(gnus-thread-sort-by-number
>           (not gnus-thread-sort-by-date)))
>
> That should give you the sorting order you want, i.e., new threads at
> the top, old threads at the bottom, but inside threads from old to new.

Nicely done!




^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Sorting with threads in Gnus
  2013-07-26 15:26                 ` Eric Abrahamsen
@ 2013-07-26 16:56                   ` Tassilo Horn
  2013-07-27  7:08                     ` Eric Abrahamsen
  0 siblings, 1 reply; 31+ messages in thread
From: Tassilo Horn @ 2013-07-26 16:56 UTC (permalink / raw)
  To: help-gnu-emacs

Eric Abrahamsen <eric@ericabrahamsen.net> writes:

>> That should give you the sorting order you want, i.e., new threads at
>> the top, old threads at the bottom, but inside threads from old to
>> new.
>
> Nicely done!

Well, you've actually pointed me to the right function, suggested what
to do, so it was a very low-hanging fruit.  We can even say it fell into
my mouth while I was laying lazily at the beach. ;-)

Bye,
Tassilo




^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Sorting with threads in Gnus
  2013-07-26 13:43               ` Tassilo Horn
  2013-07-26 15:26                 ` Eric Abrahamsen
@ 2013-07-26 17:40                 ` N. Raghavendra
  2013-07-27  8:56                   ` Tassilo Horn
  1 sibling, 1 reply; 31+ messages in thread
From: N. Raghavendra @ 2013-07-26 17:40 UTC (permalink / raw)
  To: help-gnu-emacs

At 2013-07-26T15:43:16+02:00, Tassilo Horn wrote:

> Raghavendra, could you try running the Git version of Gnus and setting
>
>   (setq gnus-sort-threads-recursively nil
>         gnus-thread-sort-functions
>         '(gnus-thread-sort-by-number
>           (not gnus-thread-sort-by-date)))
>
> That should give you the sorting order you want, i.e., new threads at
> the top, old threads at the bottom, but inside threads from old to
> new.

Thanks for the patch and the suggestions.

I've installed Gnus from Git, and set the variables as above.  I still
get the old order for the test thread I'd mentioned in my OP (you can
find it by doing GG on this group, and then typing "Trouble binding
Alt").

Best regards,
Raghavendra.

-- 
N. Raghavendra <raghu@hri.res.in>, http://www.retrotexts.net/
Harish-Chandra Research Institute, http://www.hri.res.in/




^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Sorting with threads in Gnus
  2013-07-26 16:56                   ` Tassilo Horn
@ 2013-07-27  7:08                     ` Eric Abrahamsen
  0 siblings, 0 replies; 31+ messages in thread
From: Eric Abrahamsen @ 2013-07-27  7:08 UTC (permalink / raw)
  To: help-gnu-emacs

Tassilo Horn <tsdh@gnu.org> writes:

> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>
>>> That should give you the sorting order you want, i.e., new threads at
>>> the top, old threads at the bottom, but inside threads from old to
>>> new.
>>
>> Nicely done!
>
> Well, you've actually pointed me to the right function, suggested what
> to do, so it was a very low-hanging fruit.  We can even say it fell into
> my mouth while I was laying lazily at the beach. ;-)

Not a mental image that often comes to mind while I'm coding...




^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Sorting with threads in Gnus
  2013-07-26 17:40                 ` N. Raghavendra
@ 2013-07-27  8:56                   ` Tassilo Horn
  2013-07-27  9:19                     ` N. Raghavendra
  2013-07-28  7:09                     ` N. Raghavendra
  0 siblings, 2 replies; 31+ messages in thread
From: Tassilo Horn @ 2013-07-27  8:56 UTC (permalink / raw)
  To: help-gnu-emacs

"N. Raghavendra" <raghu@hri.res.in> writes:

>> Raghavendra, could you try running the Git version of Gnus and setting
>>
>>   (setq gnus-sort-threads-recursively nil
>>         gnus-thread-sort-functions
>>         '(gnus-thread-sort-by-number
>>           (not gnus-thread-sort-by-date)))
>>
>> That should give you the sorting order you want, i.e., new threads at
>> the top, old threads at the bottom, but inside threads from old to
>> new.
>
> I've installed Gnus from Git, and set the variables as above.  I still
> get the old order for the test thread I'd mentioned in my OP (you can
> find it by doing GG on this group, and then typing "Trouble binding
> Alt").

That's strange.  With the settings above, I get this sorting order which
looks good to me.

--8<---------------cut here---------------start------------->8---
R ┃ +┃Chris Seberino         ┃ ╭●  Trouble binding Alt... <Jul 06 2013 23:18>
R ┃  ┃Pascal J. Bourguignon  ┃  ├──❯   <Jul 07 2013 00:16>
O ┃  ┃Peter Dyballa          ┃  ├──❯   <Jul 07 2013 00:21>
O ┃  ┃Bob Proulx             ┃  ├──❯   <Jul 07 2013 04:44>
O ┃  ┃Yuri Khan              ┃  ├──❯   <Jul 07 2013 05:49>
O ┃  ┃Chris Seberino         ┃  ╰──❯   <Jul 07 2013 07:08>
O ┃  ┃Raffaele Ricciardi     ┃   ├──❯   <Jul 07 2013 14:24>
O ┃  ┃Pascal J. Bourguignon  ┃   ╰──❯   <Jul 07 2013 14:51>
O ┃  ┃Chris Seberino         ┃    ╰──❯   <Jul 07 2013 22:50>
O ┃  ┃Pascal J. Bourguignon  ┃     ╰──❯   <Jul 08 2013 00:06>
O ┃  ┃Pascal J. Bourguignon  ┃      ╰──❯   <Jul 07 2013 14:49>
--8<---------------cut here---------------end--------------->8---

I also have

  (setq gnus-sort-gathered-threads-function 'gnus-thread-sort-by-date)

but using the default value of 'gnus-thread-sort-by-number results in
the very same order.

I think, you are still running the emacs builtin version of Gnus.  At
least your last posting still said

  User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

where it should be

  User-Agent: Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.3.50 (gnu/linux)

for the git version of Gnus.

Bye,
Tassilo




^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Sorting with threads in Gnus
  2013-07-27  8:56                   ` Tassilo Horn
@ 2013-07-27  9:19                     ` N. Raghavendra
  2013-07-29  6:53                       ` Tassilo Horn
  2013-07-28  7:09                     ` N. Raghavendra
  1 sibling, 1 reply; 31+ messages in thread
From: N. Raghavendra @ 2013-07-27  9:19 UTC (permalink / raw)
  To: help-gnu-emacs

At 2013-07-27T10:56:39+02:00, Tassilo Horn wrote:

> I think, you are still running the emacs builtin version of Gnus.  At
> least your last posting still said
>
>   User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)
>
> where it should be
>
>   User-Agent: Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.3.50 (gnu/linux)
>
> for the git version of Gnus.

Okay, that must be the problem.  I did an

(add-to-list 'load-path "/pkg/gnus/lisp")

at the beginning of my Gnus init file, where /pkg/gnus is where I'd kept
the Git version.  I also had

(setq gnus-sort-threads-recursively nil)

(setq gnus-thread-sort-functions
      '(gnus-thread-sort-by-number (not gnus-thread-sort-by-date)))

in my Gnus init file.  I'll try again and get back.

Best regards,
Raghu.

-- 
N. Raghavendra <raghu@hri.res.in>, http://www.retrotexts.net/
Harish-Chandra Research Institute, http://www.hri.res.in/




^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Sorting with threads in Gnus
  2013-07-27  8:56                   ` Tassilo Horn
  2013-07-27  9:19                     ` N. Raghavendra
@ 2013-07-28  7:09                     ` N. Raghavendra
  2013-07-28  8:03                       ` Michael Heerdegen
  2013-07-30  8:07                       ` Tassilo Horn
  1 sibling, 2 replies; 31+ messages in thread
From: N. Raghavendra @ 2013-07-28  7:09 UTC (permalink / raw)
  To: help-gnu-emacs

At 2013-07-27T10:56:39+02:00, Tassilo Horn wrote:

> I think, you are still running the emacs builtin version of Gnus.  At
> least your last posting still said
>
>   User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)
>
> where it should be
>
>   User-Agent: Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.3.50 (gnu/linux)
>
> for the git version of Gnus.

Okay, I've found why the Git version wasn't loaded.  I was loading
org-contacts before

(add-to-list 'load-path "/pkg/gnus/lisp")
(require 'gnus-load)

in my .emacs.  Org-contacts requires Gnus, so the old version of Gnus
was already loaded before the above expressions were evaluated.  Now,
I've changed the order of loading, putting the above before loading
org-contacts.  Now

M-x gnus-version

gives "Ma Gnus v0.8" as desired.

As for the original problem, the test thread is now sorted like this:

O. 2013-07-07 02:48   Chris Seberino         ● Trouble binding Alt ...
O. 2013-07-07 03:46   Pascal J. Bourguigno   ┣━□ 
O. 2013-07-07 09:19   Yuri Khan              ┣━□ 
O. 2013-07-07 03:51   Peter Dyballa          ┣━□ 
O. 2013-07-07 08:14   Bob Proulx             ┣━□ 
O. 2013-07-07 10:38   Chris Seberino         ┗━■ 
O. 2013-07-07 18:21   Pascal J. Bourguigno     ┣━□ 
O. 2013-07-08 02:20   Chris Seberino           ┃ ┗━■ 
O. 2013-07-08 03:36   Pascal J. Bourguigno     ┃   ┗━■ 
O. 2013-07-07 17:54   Raffaele Ricciardi       ┗━■ 

It isn't quite the ascending order by date within the thread: Yuri
Khan's article should've been two positions below, and Raffaele
Ricciardi's three positions above.

I have

(setq gnus-sort-threads-recursively nil)

(setq gnus-thread-sort-functions
      '(gnus-thread-sort-by-number (not gnus-thread-sort-by-date)))

(setq gnus-sort-gathered-threads-function 'gnus-thread-sort-by-date)

in my Gnus init file.

Best regards,
Raghu.

-- 
N. Raghavendra <raghu@hri.res.in>, http://www.retrotexts.net/
Harish-Chandra Research Institute, http://www.hri.res.in/




^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Sorting with threads in Gnus
  2013-07-28  7:09                     ` N. Raghavendra
@ 2013-07-28  8:03                       ` Michael Heerdegen
  2013-07-28  9:50                         ` N. Raghavendra
  2013-07-30  8:07                       ` Tassilo Horn
  1 sibling, 1 reply; 31+ messages in thread
From: Michael Heerdegen @ 2013-07-28  8:03 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,

> As for the original problem, the test thread is now sorted like this:
>
> O. 2013-07-07 02:48   Chris Seberino         ● Trouble binding Alt ...
> O. 2013-07-07 03:46   Pascal J. Bourguigno   ┣━□ 
> O. 2013-07-07 09:19   Yuri Khan              ┣━□ 
> O. 2013-07-07 03:51   Peter Dyballa          ┣━□ 
> O. 2013-07-07 08:14   Bob Proulx             ┣━□ 
> O. 2013-07-07 10:38   Chris Seberino         ┗━■ 
> O. 2013-07-07 18:21   Pascal J. Bourguigno     ┣━□ 
> O. 2013-07-08 02:20   Chris Seberino           ┃ ┗━■ 
> O. 2013-07-08 03:36   Pascal J. Bourguigno     ┃   ┗━■ 
> O. 2013-07-07 17:54   Raffaele Ricciardi       ┗━■ 
>
> It isn't quite the ascending order by date within the thread: Yuri
> Khan's article should've been two positions below, and Raffaele
> Ricciardi's three positions above.

Some time ago, I think I had the same problem.  The solution for me was

  (setq gnus-summary-make-false-root 'empty)

Can you try that?

In my case, the problem was how gathered threads were attached to a
false root.  With the default value 'adopt of
`gnus-summary-make-false-root', AFAIKT the gathered subthreads attached
to the false root appear in the order they are in your inbox, so that
the collected thread is indeed not sorted (although all subthreads are).


Regards,

Michael.




^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Sorting with threads in Gnus
  2013-07-28  8:03                       ` Michael Heerdegen
@ 2013-07-28  9:50                         ` N. Raghavendra
  2013-07-28 12:45                           ` Michael Heerdegen
  0 siblings, 1 reply; 31+ messages in thread
From: N. Raghavendra @ 2013-07-28  9:50 UTC (permalink / raw)
  To: help-gnu-emacs

At 2013-07-28T10:03:22+02:00, Michael Heerdegen wrote:

> Some time ago, I think I had the same problem.  The solution for me was
>
>   (setq gnus-summary-make-false-root 'empty)
>
> Can you try that?

I did, but the order remains the same as in my previous message.

Best regards,
Raghu.

-- 
N. Raghavendra <raghu@hri.res.in>, http://www.retrotexts.net/
Harish-Chandra Research Institute, http://www.hri.res.in/




^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Sorting with threads in Gnus
  2013-07-28  9:50                         ` N. Raghavendra
@ 2013-07-28 12:45                           ` Michael Heerdegen
  2013-07-28 16:17                             ` N. Raghavendra
  2013-07-29  5:16                             ` N. Raghavendra
  0 siblings, 2 replies; 31+ messages in thread
From: Michael Heerdegen @ 2013-07-28 12:45 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 597 bytes --]

"N. Raghavendra" <raghu@hri.res.in> writes:

> I did, but the order remains the same as in my previous message.

Sorry, after reading your original post again, I only now understand
what you want to reach.

AFAICT, this isn't possible by default.  Sorting threads at the top
level and recursively is done according to the same setting:
`gnus-thread-sort-functions'.  So, I think what your see is expected.

To get what you want, you AFAIK must rewrite
`gnus-sort-threads-recursive' so that it handles the top-level
specially.

I think this does what you want (please load it after loading Gnus):


[-- Attachment #2: threads.el --]
[-- Type: application/emacs-lisp, Size: 687 bytes --]

[-- Attachment #3: Type: text/plain, Size: 37 bytes --]


Is that right?


Regards,

Michael.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Sorting with threads in Gnus
  2013-07-28 12:45                           ` Michael Heerdegen
@ 2013-07-28 16:17                             ` N. Raghavendra
  2013-07-30  7:05                               ` Tassilo Horn
  2013-07-29  5:16                             ` N. Raghavendra
  1 sibling, 1 reply; 31+ messages in thread
From: N. Raghavendra @ 2013-07-28 16:17 UTC (permalink / raw)
  To: help-gnu-emacs

At 2013-07-28T14:45:00+02:00, Michael Heerdegen wrote:

> I think this does what you want (please load it after loading Gnus):
>
> (setq gnus-sort-gathered-threads-function
>       #'gnus-thread-sort-by-number)
> (setq gnus-thread-sort-functions
>       '((not gnus-thread-sort-by-number)))
>
> (defun gnus-sort-threads-recursive (threads func)
>   (sort (mapcar (lambda (thread)
> 		  (cons (car thread)
> 			(and (cdr thread)
> 			     (gnus-sort-threads-recursive-1
> 			      (cdr thread) func))))
> 		threads) func))
>
> (defun gnus-sort-threads-recursive-1 (threads func)
>   (setq func (gnus-make-sort-function
> 	      '(gnus-thread-sort-by-number)))
>   (sort (mapcar (lambda (thread)
> 		  (cons (car thread)
> 			(and (cdr thread)
> 			     (gnus-sort-threads-recursive-1
> 			      (cdr thread) func))))
> 		threads) func))
>
> Is that right?

Thanks.  I'll try it and get back.

Best regards,
Raghu.

-- 
N. Raghavendra <raghu@hri.res.in>, http://www.retrotexts.net/
Harish-Chandra Research Institute, http://www.hri.res.in/




^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Sorting with threads in Gnus
  2013-07-28 12:45                           ` Michael Heerdegen
  2013-07-28 16:17                             ` N. Raghavendra
@ 2013-07-29  5:16                             ` N. Raghavendra
  1 sibling, 0 replies; 31+ messages in thread
From: N. Raghavendra @ 2013-07-29  5:16 UTC (permalink / raw)
  To: help-gnu-emacs

At 2013-07-28T14:45:00+02:00, Michael Heerdegen wrote:

> To get what you want, you AFAIK must rewrite
> `gnus-sort-threads-recursive' so that it handles the top-level
> specially.
>
> I think this does what you want (please load it after loading Gnus):
> ...
> Is that right?

I think I'll try out Tassilo's `gnus-sort-threads-recursively' for a
while.  Setting it to nil doesn't display my test thread as I wanted,
but, for reasons unknown to me, it seems to work for other threads,
e.g.,

2013-07-23 14:19   => gmane.emacs.help    ● Sorting with threads in Gnus
2013-07-23 14:19   Gmane Autoauthorizer   ┣━□ gmane.emacs.help: Authoriz
2013-07-23 16:00   -> Gmane Autoauthori   ┃ ┗━■ 
2013-07-23 16:01   Gmane Autoauthorizer   ┃   ┗━■ Re: Authorization requi
2013-07-24 11:51   Eric Abrahamsen        ┗━■ Re: Sorting with threads in
2013-07-24 13:47   => gmane.emacs.help      ┣━□ 
2013-07-24 18:45   Tassilo Horn             ┗━■ 
2013-07-26 10:07   Eric Abrahamsen            ┗━■ 
2013-07-26 11:18   Tassilo Horn                 ┗━■ 
2013-07-26 14:31   Eric Abrahamsen                ┗━■ 
2013-07-26 18:36   Tassilo Horn                     ┗━■ 
2013-07-26 18:56   Tassilo Horn                       ┗━■ 
2013-07-26 19:13   Tassilo Horn                         ┗━■ 
2013-07-26 20:56   Eric Abrahamsen                        ┣━□ 
2013-07-26 22:26   Tassilo Horn                           ┃ ┗━■ 
2013-07-27 12:38   Eric Abrahamsen                        ┃   ┗━■ 
2013-07-26 23:10   => gmane.emacs.help                    ┗━■ 
2013-07-27 14:26   Tassilo Horn                             ┗━■ 
2013-07-27 14:49   => gmane.emacs.help                        ┣━□ 
2013-07-28 12:39   => gmane.emacs.help                        ┗━■ 
2013-07-28 13:33   Michael Heerdegen                            ┗━■ 
2013-07-28 15:20   => gmane.emacs.help                            ┗━■ 
2013-07-28 18:15   Michael Heerdegen                                ┗━■ 
2013-07-28 21:47   => gmane.emacs.help                                ┗━■ 

Thanks all the same for your suggestions.

Best regards,
Raghu.

-- 
N. Raghavendra <raghu@hri.res.in>, http://www.retrotexts.net/
Harish-Chandra Research Institute, http://www.hri.res.in/




^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Sorting with threads in Gnus
  2013-07-27  9:19                     ` N. Raghavendra
@ 2013-07-29  6:53                       ` Tassilo Horn
  2013-07-29  7:42                         ` N. Raghavendra
  0 siblings, 1 reply; 31+ messages in thread
From: Tassilo Horn @ 2013-07-29  6:53 UTC (permalink / raw)
  To: help-gnu-emacs

"N. Raghavendra" <raghu@hri.res.in> writes:

>> least your last posting still said
>>
>>   User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)
>>
>> where it should be
>>
>>   User-Agent: Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.3.50 (gnu/linux)
>>
>> for the git version of Gnus.
>
> Okay, that must be the problem.  I did an
>
> (add-to-list 'load-path "/pkg/gnus/lisp")
>
> at the beginning of my Gnus init file, where /pkg/gnus is where I'd kept
> the Git version.

That's too late.  You have to put that into your ~/.emacs.

Bye,
Tassilo




^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Sorting with threads in Gnus
  2013-07-29  6:53                       ` Tassilo Horn
@ 2013-07-29  7:42                         ` N. Raghavendra
  0 siblings, 0 replies; 31+ messages in thread
From: N. Raghavendra @ 2013-07-29  7:42 UTC (permalink / raw)
  To: help-gnu-emacs

At 2013-07-29T08:53:29+02:00, Tassilo Horn wrote:

> That's too late.  You have to put that into your ~/.emacs.

Yes, I realised my mistake after rereading the Git Gnus README.  I've
also posted follow-ups on the main issue.

Best regards,
Raghu.

-- 
N. Raghavendra <raghu@hri.res.in>, http://www.retrotexts.net/
Harish-Chandra Research Institute, http://www.hri.res.in/




^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Sorting with threads in Gnus
  2013-07-28 16:17                             ` N. Raghavendra
@ 2013-07-30  7:05                               ` Tassilo Horn
  2013-07-30  7:24                                 ` Eric Abrahamsen
  0 siblings, 1 reply; 31+ messages in thread
From: Tassilo Horn @ 2013-07-30  7:05 UTC (permalink / raw)
  To: help-gnu-emacs

"N. Raghavendra" <raghu@hri.res.in> writes:

>> I think this does what you want (please load it after loading Gnus):
>>
>> (setq gnus-sort-gathered-threads-function
>>       #'gnus-thread-sort-by-number)
>> (setq gnus-thread-sort-functions
>>       '((not gnus-thread-sort-by-number)))
>>
>> (defun gnus-sort-threads-recursive (threads func)
>>   (sort (mapcar (lambda (thread)
>> 		  (cons (car thread)
>> 			(and (cdr thread)
>> 			     (gnus-sort-threads-recursive-1
>> 			      (cdr thread) func))))
>> 		threads) func))
>>
>> (defun gnus-sort-threads-recursive-1 (threads func)
>>   (setq func (gnus-make-sort-function
>> 	      '(gnus-thread-sort-by-number)))
>>   (sort (mapcar (lambda (thread)
>> 		  (cons (car thread)
>> 			(and (cdr thread)
>> 			     (gnus-sort-threads-recursive-1
>> 			      (cdr thread) func))))
>> 		threads) func))
>>
>> Is that right?
>
> Thanks.  I'll try it and get back.

I think Michael might be correct, and still sorting of inner threads
according to date or number is needed.  I've changed that now in the
Gnus code.  So if `gnus-sort-threads-recursively' is nil, then
subthreads are explicitly sorted by date.

Now using

--8<---------------cut here---------------start------------->8---
(setq gnus-thread-sort-functions
      '(gnus-thread-sort-by-number
	gnus-thread-sort-by-most-recent-date
        gnus-thread-sort-by-date
	gnus-thread-sort-by-total-score)
      gnus-sort-gathered-threads-function 'gnus-thread-sort-by-date
      gnus-sort-threads-recursively nil)
--8<---------------cut here---------------end--------------->8---

I get

--8<---------------cut here---------------start------------->8---
O ┃ +┃Chris Seberino         ┃ ╭●  Trouble binding Alt...
O ┃ +┃Pascal J. Bourguignon  ┃ ├──❯   <Jul 07 2013 00:16>
O ┃ +┃Peter Dyballa          ┃ ├──❯   <Jul 07 2013 00:21>
O ┃ +┃Bob Proulx             ┃ ├──❯   <Jul 07 2013 04:44>
R ┃ +┃Yuri Khan              ┃ ├──❯   <Jul 07 2013 05:49>
O ┃ +┃Chris Seberino         ┃ ├──❯   <Jul 07 2013 07:08>
O ┃ +┃Raffaele Ricciardi     ┃ │├──❯   <Jul 07 2013 14:24>
O ┃ +┃Pascal J. Bourguignon  ┃ │╰──❯   <Jul 07 2013 14:51>
O ┃ +┃Chris Seberino         ┃ │ ╰──❯   <Jul 07 2013 22:50>
O ┃ +┃Pascal J. Bourguignon  ┃ │  ╰──❯   <Jul 08 2013 00:06>
Q ┃  ┃                       ┃ ╰──❯   <Jul 07 2013 14:49>
O ┃ +┃Pascal J. Bourguignon  ┃  ╰──❯   <Jul 07 2013 14:49>
--8<---------------cut here---------------end--------------->8---

That's actually the same as the order I had before my latest change, but
maybe that was only a coincidence.  At least it seems more correct to
explicitly sort subthreads chronologically instead of not sorting them
at all.

Bye,
Tassilo




^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Sorting with threads in Gnus
  2013-07-30  7:05                               ` Tassilo Horn
@ 2013-07-30  7:24                                 ` Eric Abrahamsen
  2013-07-30  8:01                                   ` Tassilo Horn
  0 siblings, 1 reply; 31+ messages in thread
From: Eric Abrahamsen @ 2013-07-30  7:24 UTC (permalink / raw)
  To: help-gnu-emacs

Tassilo Horn <tsdh@gnu.org> writes:

> "N. Raghavendra" <raghu@hri.res.in> writes:
>
>>> I think this does what you want (please load it after loading Gnus):
>>>
>>> (setq gnus-sort-gathered-threads-function
>>>       #'gnus-thread-sort-by-number)
>>> (setq gnus-thread-sort-functions
>>>       '((not gnus-thread-sort-by-number)))
>>>
>>> (defun gnus-sort-threads-recursive (threads func)
>>>   (sort (mapcar (lambda (thread)
>>> 		  (cons (car thread)
>>> 			(and (cdr thread)
>>> 			     (gnus-sort-threads-recursive-1
>>> 			      (cdr thread) func))))
>>> 		threads) func))
>>>
>>> (defun gnus-sort-threads-recursive-1 (threads func)
>>>   (setq func (gnus-make-sort-function
>>> 	      '(gnus-thread-sort-by-number)))
>>>   (sort (mapcar (lambda (thread)
>>> 		  (cons (car thread)
>>> 			(and (cdr thread)
>>> 			     (gnus-sort-threads-recursive-1
>>> 			      (cdr thread) func))))
>>> 		threads) func))
>>>
>>> Is that right?
>>
>> Thanks.  I'll try it and get back.
>
> I think Michael might be correct, and still sorting of inner threads
> according to date or number is needed.  I've changed that now in the
> Gnus code.  So if `gnus-sort-threads-recursively' is nil, then
> subthreads are explicitly sorted by date.
>
> Now using
>
> (setq gnus-thread-sort-functions
>       '(gnus-thread-sort-by-number
> 	gnus-thread-sort-by-most-recent-date
>         gnus-thread-sort-by-date
> 	gnus-thread-sort-by-total-score)
>       gnus-sort-gathered-threads-function 'gnus-thread-sort-by-date
>       gnus-sort-threads-recursively nil)
>
> I get
>
> O ┃ +┃Chris Seberino         ┃ ╭●  Trouble binding Alt...
> O ┃ +┃Pascal J. Bourguignon  ┃ ├──❯   <Jul 07 2013 00:16>
> O ┃ +┃Peter Dyballa          ┃ ├──❯   <Jul 07 2013 00:21>
> O ┃ +┃Bob Proulx             ┃ ├──❯   <Jul 07 2013 04:44>
> R ┃ +┃Yuri Khan              ┃ ├──❯   <Jul 07 2013 05:49>
> O ┃ +┃Chris Seberino         ┃ ├──❯   <Jul 07 2013 07:08>
> O ┃ +┃Raffaele Ricciardi     ┃ │├──❯   <Jul 07 2013 14:24>
> O ┃ +┃Pascal J. Bourguignon  ┃ │╰──❯   <Jul 07 2013 14:51>
> O ┃ +┃Chris Seberino         ┃ │ ╰──❯   <Jul 07 2013 22:50>
> O ┃ +┃Pascal J. Bourguignon  ┃ │  ╰──❯   <Jul 08 2013 00:06>
> Q ┃  ┃                       ┃ ╰──❯   <Jul 07 2013 14:49>
> O ┃ +┃Pascal J. Bourguignon  ┃  ╰──❯   <Jul 07 2013 14:49>
>
> That's actually the same as the order I had before my latest change, but
> maybe that was only a coincidence.  At least it seems more correct to
> explicitly sort subthreads chronologically instead of not sorting them
> at all.

I think it defaults to sorting by article number, which often looks a
lot like date -- docs seem to say that one is dependent on when the
message is sent, and the other on when it arrives...




^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Sorting with threads in Gnus
  2013-07-30  7:24                                 ` Eric Abrahamsen
@ 2013-07-30  8:01                                   ` Tassilo Horn
  2013-07-30 10:53                                     ` Eric Abrahamsen
  0 siblings, 1 reply; 31+ messages in thread
From: Tassilo Horn @ 2013-07-30  8:01 UTC (permalink / raw)
  To: help-gnu-emacs

Eric Abrahamsen <eric@ericabrahamsen.net> writes:

>> That's actually the same as the order I had before my latest change,
>> but maybe that was only a coincidence.  At least it seems more
>> correct to explicitly sort subthreads chronologically instead of not
>> sorting them at all.
>
> I think it defaults to sorting by article number, which often looks a
> lot like date -- docs seem to say that one is dependent on when the
> message is sent, and the other on when it arrives...

Yeah, but my code stopped sorting of subthreads at all.  So I basically
assumed that the threads were sorted according to article number before
they were passed to the thread sorting functions.  That's probably a
false assumption.

Anyway, my last changes made the name `gnus-sort-threads-recursively'
inappropriate.  And also it was only a minor step away from custom
subthread sorting.  So now I've implemented that:

,----
| commit fff80f88ef397fca65cb382217ce9c9a08b1329e
| Author: Tassilo Horn <tsdh@gnu.org>
| Date:   Tue Jul 30 09:52:15 2013 +0200
| 
|     Make subthread sorting customizable and add docs for it.
|     
|     * gnus-sum.el (gnus-subthread-sort-functions): New defcustom.
|     (gnus-sort-threads-recursively): Delete defcustom.
|     (gnus-sort-threads-recursive): Adapt accordingly.
|     
|     * gnus.texi (Sorting the Summary Buffer): Document new defcustom
|     `gnus-subthread-sort-functions' and remove the obsolete documentation
|     of `gnus-sort-threads-recursively'.
| 
`----

So `gnus-sort-threads-recursively' is gone now, and
`gnus-subthread-sort-functions' takes its place.  By default its value
is 'gnus-thread-sort-functions which means to sort subthreads also using
`gnus-thread-sort-functions', but you can set it to any list of sort
functions you want.

So now I use this:

--8<---------------cut here---------------start------------->8---
(setq gnus-thread-sort-functions '(gnus-thread-sort-by-number
				   gnus-thread-sort-by-most-recent-date
				   gnus-thread-sort-by-total-score)
      gnus-subthread-sort-functions '(gnus-thread-sort-by-number
				      gnus-thread-sort-by-date)
      gnus-sort-gathered-threads-function 'gnus-thread-sort-by-date)
--8<---------------cut here---------------end--------------->8---

So threads are sorted from highest score/most recent article to lowest
score/least recent article, but inside threads I simply sort from old to
new.

Bye,
Tassilo




^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Sorting with threads in Gnus
  2013-07-28  7:09                     ` N. Raghavendra
  2013-07-28  8:03                       ` Michael Heerdegen
@ 2013-07-30  8:07                       ` Tassilo Horn
  2013-07-30 11:00                         ` N. Raghavendra
  1 sibling, 1 reply; 31+ messages in thread
From: Tassilo Horn @ 2013-07-30  8:07 UTC (permalink / raw)
  To: help-gnu-emacs

Hi Raghavendra,

I've now made subthread sorting customizable.  Please check my posting

  Message-ID: <87hafccw7z.fsf@thinkpad.tsdh.org>

and see if that works for you.

Bye,
Tassilo




^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Sorting with threads in Gnus
  2013-07-30  8:01                                   ` Tassilo Horn
@ 2013-07-30 10:53                                     ` Eric Abrahamsen
  0 siblings, 0 replies; 31+ messages in thread
From: Eric Abrahamsen @ 2013-07-30 10:53 UTC (permalink / raw)
  To: help-gnu-emacs

Tassilo Horn <tsdh@gnu.org> writes:

> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>
>>> That's actually the same as the order I had before my latest change,
>>> but maybe that was only a coincidence.  At least it seems more
>>> correct to explicitly sort subthreads chronologically instead of not
>>> sorting them at all.
>>
>> I think it defaults to sorting by article number, which often looks a
>> lot like date -- docs seem to say that one is dependent on when the
>> message is sent, and the other on when it arrives...
>
> Yeah, but my code stopped sorting of subthreads at all.  So I basically
> assumed that the threads were sorted according to article number before
> they were passed to the thread sorting functions.  That's probably a
> false assumption.
>
> Anyway, my last changes made the name `gnus-sort-threads-recursively'
> inappropriate.  And also it was only a minor step away from custom
> subthread sorting.  So now I've implemented that:
>
> ,----
> | commit fff80f88ef397fca65cb382217ce9c9a08b1329e
> | Author: Tassilo Horn <tsdh@gnu.org>
> | Date:   Tue Jul 30 09:52:15 2013 +0200
> | 
> |     Make subthread sorting customizable and add docs for it.
> |     
> |     * gnus-sum.el (gnus-subthread-sort-functions): New defcustom.
> |     (gnus-sort-threads-recursively): Delete defcustom.
> |     (gnus-sort-threads-recursive): Adapt accordingly.
> |     
> |     * gnus.texi (Sorting the Summary Buffer): Document new defcustom
> |     `gnus-subthread-sort-functions' and remove the obsolete documentation
> |     of `gnus-sort-threads-recursively'.
> | 
> `----
>
> So `gnus-sort-threads-recursively' is gone now, and
> `gnus-subthread-sort-functions' takes its place.  By default its value
> is 'gnus-thread-sort-functions which means to sort subthreads also using
> `gnus-thread-sort-functions', but you can set it to any list of sort
> functions you want.
>
> So now I use this:
>
> (setq gnus-thread-sort-functions '(gnus-thread-sort-by-number
> 				   gnus-thread-sort-by-most-recent-date
> 				   gnus-thread-sort-by-total-score)
>       gnus-subthread-sort-functions '(gnus-thread-sort-by-number
> 				      gnus-thread-sort-by-date)
>       gnus-sort-gathered-threads-function 'gnus-thread-sort-by-date)
>
> So threads are sorted from highest score/most recent article to lowest
> score/least recent article, but inside threads I simply sort from old to
> new.

Very cool! I'll make use of this.




^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Sorting with threads in Gnus
  2013-07-30  8:07                       ` Tassilo Horn
@ 2013-07-30 11:00                         ` N. Raghavendra
  2013-07-30 12:33                           ` Tassilo Horn
  0 siblings, 1 reply; 31+ messages in thread
From: N. Raghavendra @ 2013-07-30 11:00 UTC (permalink / raw)
  To: help-gnu-emacs

At 2013-07-30T10:07:05+02:00, Tassilo Horn wrote:

> I've now made subthread sorting customizable.  Please check my posting
>
>   Message-ID: <87hafccw7z.fsf@thinkpad.tsdh.org>
>
> and see if that works for you.

Perfect!  I now get the test thread like this:

2013-07-07 02:48   Chris Seberino         ● Trouble binding Alt ...
2013-07-07 03:46   Pascal J. Bourguigno   ┣━□ 
2013-07-07 03:51   Peter Dyballa          ┣━□ 
2013-07-07 08:14   Bob Proulx             ┣━□ 
2013-07-07 09:19   Yuri Khan              ┣━□ 
2013-07-07 10:38   Chris Seberino         ┗━■ 
2013-07-07 17:54   Raffaele Ricciardi       ┣━□ 
2013-07-07 18:21   Pascal J. Bourguigno     ┗━■ 
2013-07-08 02:20   Chris Seberino             ┗━■ 
2013-07-08 03:36   Pascal J. Bourguigno         ┗━■ 

I have

--8<---------------cut here---------------start------------->8---
(setq gnus-thread-sort-functions
      '(gnus-thread-sort-by-number gnus-thread-sort-by-most-recent-date))

(setq gnus-subthread-sort-functions
      '(gnus-thread-sort-by-number gnus-thread-sort-by-date))

(setq gnus-sort-gathered-threads-function 'gnus-thread-sort-by-date)
--8<---------------cut here---------------end--------------->8---

in my Gnus init file.

Thanks very much.

Best regards,
Raghu.

-- 
N. Raghavendra <raghu@hri.res.in>, http://www.retrotexts.net/
Harish-Chandra Research Institute, http://www.hri.res.in/




^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Sorting with threads in Gnus
  2013-07-30 11:00                         ` N. Raghavendra
@ 2013-07-30 12:33                           ` Tassilo Horn
  0 siblings, 0 replies; 31+ messages in thread
From: Tassilo Horn @ 2013-07-30 12:33 UTC (permalink / raw)
  To: help-gnu-emacs

"N. Raghavendra" <raghu@hri.res.in> writes:

Hi!

>> I've now made subthread sorting customizable.  Please check my posting
>>
>>   Message-ID: <87hafccw7z.fsf@thinkpad.tsdh.org>
>>
>> and see if that works for you.
>
> Perfect!  I now get the test thread like this:
>
> 2013-07-07 02:48   Chris Seberino         ● Trouble binding Alt ...
> 2013-07-07 03:46   Pascal J. Bourguigno   ┣━□ 
> 2013-07-07 03:51   Peter Dyballa          ┣━□ 
> 2013-07-07 08:14   Bob Proulx             ┣━□ 
> 2013-07-07 09:19   Yuri Khan              ┣━□ 
> 2013-07-07 10:38   Chris Seberino         ┗━■ 
> 2013-07-07 17:54   Raffaele Ricciardi       ┣━□ 
> 2013-07-07 18:21   Pascal J. Bourguigno     ┗━■ 
> 2013-07-08 02:20   Chris Seberino             ┗━■ 
> 2013-07-08 03:36   Pascal J. Bourguigno         ┗━■ 
>
> I have
>
> (setq gnus-thread-sort-functions
>       '(gnus-thread-sort-by-number gnus-thread-sort-by-most-recent-date))
>
> (setq gnus-subthread-sort-functions
>       '(gnus-thread-sort-by-number gnus-thread-sort-by-date))
>
> (setq gnus-sort-gathered-threads-function 'gnus-thread-sort-by-date)
>
> in my Gnus init file.

Great that it works & thanks for testing!

Bye,
Tassilo




^ permalink raw reply	[flat|nested] 31+ messages in thread

end of thread, other threads:[~2013-07-30 12:33 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-23  8:49 Sorting with threads in Gnus N. Raghavendra
2013-07-24  6:21 ` Eric Abrahamsen
2013-07-24  8:17   ` N. Raghavendra
2013-07-24 13:15   ` Tassilo Horn
2013-07-26  4:37     ` Eric Abrahamsen
2013-07-26  5:48       ` Tassilo Horn
2013-07-26  9:01         ` Eric Abrahamsen
2013-07-26 13:06           ` Tassilo Horn
2013-07-26 13:26             ` Tassilo Horn
2013-07-26 13:43               ` Tassilo Horn
2013-07-26 15:26                 ` Eric Abrahamsen
2013-07-26 16:56                   ` Tassilo Horn
2013-07-27  7:08                     ` Eric Abrahamsen
2013-07-26 17:40                 ` N. Raghavendra
2013-07-27  8:56                   ` Tassilo Horn
2013-07-27  9:19                     ` N. Raghavendra
2013-07-29  6:53                       ` Tassilo Horn
2013-07-29  7:42                         ` N. Raghavendra
2013-07-28  7:09                     ` N. Raghavendra
2013-07-28  8:03                       ` Michael Heerdegen
2013-07-28  9:50                         ` N. Raghavendra
2013-07-28 12:45                           ` Michael Heerdegen
2013-07-28 16:17                             ` N. Raghavendra
2013-07-30  7:05                               ` Tassilo Horn
2013-07-30  7:24                                 ` Eric Abrahamsen
2013-07-30  8:01                                   ` Tassilo Horn
2013-07-30 10:53                                     ` Eric Abrahamsen
2013-07-29  5:16                             ` N. Raghavendra
2013-07-30  8:07                       ` Tassilo Horn
2013-07-30 11:00                         ` N. Raghavendra
2013-07-30 12:33                           ` Tassilo Horn

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.