Article View: news.software.readers
Article #53133Re: [slrn] Order newsgroups by expression?
From: Dawn Owens-Nicholson
Date: Wed, 13 Oct 1999 00:00
Date: Wed, 13 Oct 1999 00:00
78 lines
3383 bytes
3383 bytes
Andreas Barth wrote:
> is there a possibility to order the newsgroups in slrn according
> to a regular expressions?
Sure. Use the following macros for moving a group around (see the slrn
S-Lang API documentation on group_up_n()/group_down_n() for a description on
how these functions work--these functions move the cursor and the group at
the cursor, not just the cursor). Put these macros in a file (say,
"group_move.sl") so you can reuse them later in your own macros and keep
them in their own namespace.
implements ("Group_Move");
static define move_group_up_n (n)
{
variable
group = current_newsgroup (),
moved = 0;
loop (n)
{
call ("transpose_groups");
if (current_newsgroup () == group) break;
while (current_newsgroup () != group) () = group_search (group);
moved++;
}
return (moved);
}
static define move_group_down_n (n)
{
variable
group = current_newsgroup (),
moved = 0;
loop (n)
{
!if (group_down_n (1)) break;
call ("transpose_groups");
moved++;
if (current_newsgroup () == group) break;
() = group_up_n (1);
}
return (moved);
}
I've got a mostly completed group sorting macro going, but it doesn't do the
specific custom sort you're talking about below. It sorts the following
ways:
* ASCII order * total GroupLens count for group
* truly unread article count * apparently unread article count
* total score of articles * number of high-scoring articles
* reverse current sort order * user-defined sorting
* total Velveeta score of articles (rules I used for Velveeta scoring are in
<crosspost-stopper#19981227043014@khms.westfalen.de>)
> This means if the expression says:
> | *announce
> | news.*
> | *
> that first all announce-newsgroups should be shown, than those in
> news.* and than the rest of the groups. Order in these subgroups
> should be either like .jnewsrc, or alphabetical or reverse
> alphabetical.
By the way, the first regex ("*announce") isn't portable--it will do
different things depending on how a leading asterisk is interpreted. I
mention this because these examples suggest you're actually interested in
/wildmats/, not what are commonly called regular expressions. If you really
want wildmats, I'd say use regular expressions instead. Regexes are more
powerful and you get them for free. Wildmats are pretty much a waste of
time.
Assuming you really meant regular expressions, it's not clear how you want
to sort groups--if a group matches two or more regexes, where would the
group end up?
Technical Details
Message-ID:
<slrn8086bo.l6k.bluemoon@ux6.cso.uiuc.edu>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!not-for-mailReferences:
<slrn8016jk.29e.aba@aphrodite.muenchen.pro-bahn.de>Show Full Headers
Complete Article Headers
Message-ID: <slrn8086bo.l6k.bluemoon@ux6.cso.uiuc.edu> Subject: Re: [slrn] Order newsgroups by expression? Date: Wed, 13 Oct 1999 00:00:00 +0000 From: bluemoon@ux6.cso.uiuc.edu (Dawn Owens-Nicholson) References: <slrn8016jk.29e.aba@aphrodite.muenchen.pro-bahn.de> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!not-for-mail X-Deja-AN: 536120546 Organization: University of Illinois at Urbana-Champaign User-Agent: slrn/0.9.5.7 (UNIX) Newsgroups: news.software.readers