Discussion:
slrn: Sort most recently active threads first?
Add Reply
Jay
2021-06-16 17:01:38 UTC
Reply
Permalink
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
2021-06-17 15:30:52 UTC
Reply
Permalink
Post by Jay
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.
--
_o) $ lynx lock.cmpxchg8b.com
/\\ _o) _o) $ finger ***@sdf.org
_\_V _( ) _( ) @taviso
Jay
2021-06-17 15:35:28 UTC
Reply
Permalink
Post by Tavis Ormandy
Post by Jay
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`.
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
2021-06-17 18:58:41 UTC
Reply
Permalink
Post by Jay
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");
--
_o) $ lynx lock.cmpxchg8b.com
/\\ _o) _o) $ finger ***@sdf.org
_\_V _( ) _( ) @taviso
Tavis Ormandy
2021-06-17 23:19:11 UTC
Reply
Permalink
Post by Tavis Ormandy
Post by Jay
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();

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");
--
_o) $ lynx lock.cmpxchg8b.com
/\\ _o) _o) $ finger ***@sdf.org
_\_V _( ) _( ) @taviso
Jay
2021-06-18 13:43:34 UTC
Reply
Permalink
Post by Tavis Ormandy
Post by Tavis Ormandy
Post by Jay
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?
- 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
2021-06-26 11:39:14 UTC
Reply
Permalink
Post by Tavis Ormandy
- 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.
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
2021-06-26 11:44:34 UTC
Reply
Permalink
Post by Lewis
Post by Tavis Ormandy
- 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.
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
2021-08-02 14:50:15 UTC
Reply
Permalink
Thanks so much Tavis. I am looking for a solution to this for years.
Bolloy Benders Family
2021-06-18 03:25:00 UTC
Reply
Permalink
Post by Jay
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
2021-06-18 04:12:06 UTC
Reply
Permalink
Post by Bolloy Benders Family
Post by Jay
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.

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