Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

slrn: Sort most recently active threads first?

36 views
Skip to first unread message

Jay

unread,
Jun 16, 2021, 1:01:44 PM6/16/21
to
Is there a way in slrn to sort the most "recently active" threads first? So if a
collapsed thread has been replied to today, I want it to show up high on the
list, even if the oldest unread message in the thread was posted weeks ago.

Tavis Ormandy

unread,
Jun 17, 2021, 11:30:54 AM6/17/21
to
I think you're looking for `set sorting_method 9`.

Here is the full list of sorting methods, if you're interested:

0 do not sort
1 perform threading
2 sort by subject
3 thread, then sort by subject
4 sort by score
5 thread, then sort by score
6 sort by score, then by subject
7 thread, then sort by score and subject
8 sort by date with most recent first
9 thread, then sort by date with most recent first
10 sort by date with most recent last
11 thread, then sort by date with most recent last
12 custom sorting

Tavis.


--
_o) $ lynx lock.cmpxchg8b.com
/\\ _o) _o) $ finger tav...@sdf.org
_\_V _( ) _( ) @taviso

Jay

unread,
Jun 17, 2021, 11:35:35 AM6/17/21
to
On 2021-06-17, Tavis Ormandy <tav...@gmail.com> wrote:
> On 2021-06-16, Jay wrote:
>> Is there a way in slrn to sort the most "recently active" threads first? So
>> if a collapsed thread has been replied to today, I want it to show up high on
>> the list, even if the oldest unread message in the thread was posted weeks
>> ago.
>
> I think you're looking for `set sorting_method 9`.
>
> Here is the full list of sorting methods, if you're interested:
>
> 0 do not sort
> 1 perform threading
> 2 sort by subject
> 3 thread, then sort by subject
> 4 sort by score
> 5 thread, then sort by score
> 6 sort by score, then by subject
> 7 thread, then sort by score and subject
> 8 sort by date with most recent first
> 9 thread, then sort by date with most recent first
> 10 sort by date with most recent last
> 11 thread, then sort by date with most recent last
> 12 custom sorting
>
> Tavis.

Thanks. That doesn't quite work; it still sorts by the date of the highest
ancestor of a thread, not by the most recent message in any given thread.

Tavis Ormandy

unread,
Jun 17, 2021, 2:58:43 PM6/17/21
to
On 2021-06-17, Jay wrote:
> Thanks. That doesn't quite work; it still sorts by the date of the highest
> ancestor of a thread, not by the most recent message in any given thread.

Ah, I don't think that's possible.

There is no sorting hook, so you can't override how articles are
compared with macros, it's all hardcoded.

It would be nice if you could write an article_mode_hook that changes
the date, but you can't do anything like replace_article() then AFAIK.

Wait... LOL.. just as I was writing this reply saying it was impossible,
I realized how you could do it. It's a weird solution, so be prepared :-)

You can't alter articles in article_mode_hook, but you can adjust the
score. What if you temporarily set the score of each article to the
unixtime it was sent, sort it, then change it back? Slrn automatically
propogates the highest score to the thread, then you can sort by score before
reapplying the old scores.

Believe it or not, I think this works!

Try the macro below.

Tavis.

define score_child_date ()
{
variable score = Assoc_Type[Int_Type, 0];
variable flags = Assoc_Type[Int_Type, 0];
variable date;
variable meth;
variable mid;

uncollapse_threads();
header_bob();

do {
date = extract_article_header("Date");
mid = extract_article_header("Message-ID");
score[mid] = get_header_score();
flags[mid] = get_header_flags();
set_header_score(datestring_to_unixtime(date));
} while (header_down(1) == 1);

meth = get_variable_value("sorting_method");
set_integer_variable("sorting_method", 5);
sort_by_sorting_method();
uncollapse_threads();

set_integer_variable("sorting_method", meth);

header_bob();

do {
mid = extract_article_header("Message-ID");
set_header_score(score[mid]);
set_header_flags(flags[mid]);
} while (header_down(1) == 1);

header_bob();
collapse_threads();
}

() = register_hook("article_mode_startup_hook", "score_child_date");

Tavis Ormandy

unread,
Jun 17, 2021, 7:19:14 PM6/17/21
to
On 2021-06-17, Tavis Ormandy wrote:
> On 2021-06-17, Jay wrote:
>> Thanks. That doesn't quite work; it still sorts by the date of the highest
>> ancestor of a thread, not by the most recent message in any given thread.
>
> You can't alter articles in article_mode_hook, but you can adjust the
> score. What if you temporarily set the score of each article to the
> unixtime it was sent, sort it, then change it back?

I made some improvements:

- Using UNIX time works but doesn't handle timezones. A better idea
is to make slrn sort it then reuse whatever index it assigns the message.
- It turns out sorting updates the flags displayed, so they were out
of sync.

I've been using it today, I kinda like it.

I think you just need this in your .slrnrc:

interpret "util.sl"
interpret "/path/to/this/macro.sl"

Then save the following macro somewhere.

define score_child_date ()
{
variable score = Assoc_Type[Int_Type, 0];
variable flags = Assoc_Type[Int_Type, 0];
variable mid;
variable num = 0;

set_integer_variable("sorting_method", 10);
sort_by_sorting_method();

header_bob();

do {
mid = extract_article_header("Message-ID");
score[mid] = get_header_score();
flags[mid] = get_header_flags();
set_header_score(num);
set_header_flags(flags[mid]);
num = num + 1;
} while (header_down(1) == 1);

set_integer_variable("sorting_method", 5);
sort_by_sorting_method();
uncollapse_threads();

Bolloy Benders Family

unread,
Jun 17, 2021, 11:25:04 PM6/17/21
to
On Thu, 17 Jun 2021 10:35:28 -0500, Jay <j...@jay.xyz> wrote:

>> S sort by date with most recent last
>
>Thanks. That doesn't quite work; it still sorts by the date of the highest
>ancestor of a thread, not by the most recent message in any given thread.

This will do what you want. This won't thread posts.

Enter the newsgroup then press the "escape" key then "s" key and then
the "A" key.

ESC -> s -> A

If you want the newsgroup subject list sorted so that the latest date
is displayed at the top of the subject list:

ESC -> s -> 8

--

)" .
/ \ (\-./
/ | _/ o. \
| | .-" y)-
| |/ _/ \
\ /j _".\(@)
\ ( | `.'' )
\ _`- | /
" `-._ <_ (
`-.,),)

Tavis Ormandy

unread,
Jun 18, 2021, 12:12:09 AM6/18/21
to
On 2021-06-18, Bolloy Benders Family wrote:
> On Thu, 17 Jun 2021 10:35:28 -0500, Jay <j...@jay.xyz> wrote:
>
>>> S sort by date with most recent last
>>
>>Thanks. That doesn't quite work; it still sorts by the date of the highest
>>ancestor of a thread, not by the most recent message in any given thread.
>
> This will do what you want. This won't thread posts.
>

I think the question is how to sort threads by most recent activity.

e.g.

Thread A [1st Jan]
- Re: Thread A [2nd Jan]
Thread B [2nd Jan]
- Re: Thread B [3rd Jan]

Thread B should come first, because it has more recent activity. I think
a macro is necessary.

Jay

unread,
Jun 18, 2021, 9:43:40 AM6/18/21
to
On 2021-06-17, Tavis Ormandy <tav...@gmail.com> wrote:
> On 2021-06-17, Tavis Ormandy wrote:
>> On 2021-06-17, Jay wrote:
>>> Thanks. That doesn't quite work; it still sorts by the date of the highest
>>> ancestor of a thread, not by the most recent message in any given thread.
>>
>> You can't alter articles in article_mode_hook, but you can adjust the
>> score. What if you temporarily set the score of each article to the
>> unixtime it was sent, sort it, then change it back?
>
> I made some improvements:
>
> - Using UNIX time works but doesn't handle timezones. A better idea
> is to make slrn sort it then reuse whatever index it assigns the
> message.
> - It turns out sorting updates the flags displayed, so they were out
> of sync.
>
> I've been using it today, I kinda like it.

Thanks!

Lewis

unread,
Jun 26, 2021, 7:39:17 AM6/26/21
to
In message <ij23jf...@mid.individual.net> Tavis Ormandy <tav...@gmail.com> wrote:
> I made some improvements:

> - Using UNIX time works but doesn't handle timezones. A better idea
> is to make slrn sort it then reuse whatever index it assigns the message.
> - It turns out sorting updates the flags displayed, so they were out
> of sync.

> I've been using it today, I kinda like it.

> I think you just need this in your .slrnrc:

> interpret "util.sl"
> interpret "/path/to/this/macro.sl"

> Then save the following macro somewhere.

Once this is done, does the macro just run when a group is loaded? I
don't see what it is doing when I load a group.

--
With the exception of the wit and wisdom of Calvin and Hobbes, not much lasts forever.

Lewis

unread,
Jun 26, 2021, 7:44:35 AM6/26/21
to
In message <slrnsde4f2....@m1mini.local> Lewis <g.k...@kreme.dont-email.me> wrote:
> In message <ij23jf...@mid.individual.net> Tavis Ormandy <tav...@gmail.com> wrote:
>> I made some improvements:

>> - Using UNIX time works but doesn't handle timezones. A better idea
>> is to make slrn sort it then reuse whatever index it assigns the message.
>> - It turns out sorting updates the flags displayed, so they were out
>> of sync.

>> I've been using it today, I kinda like it.

>> I think you just need this in your .slrnrc:

>> interpret "util.sl"
>> interpret "/path/to/this/macro.sl"

>> Then save the following macro somewhere.

> Once this is done, does the macro just run when a group is loaded? I
> don't see what it is doing when I load a group.

This is what a group looks like when loading the macro:

https://imgur.com/9AVgqKJ


--
The Steve is seen, rightly or wrongly, as the visionary, the leader,
the savant. Bill is the Boswell to The Steve's Johnson, but
lacking Boswell's wit, charm, and dynamic personality.

Lis Khittan

unread,
Aug 2, 2021, 10:50:16 AM8/2/21
to
Thanks so much Tavis. I am looking for a solution to this for years.

0 new messages