Article View: news.software.readers
Article #263663Re: [slrn] Applying scores before entering groups
From: J.B. Nicholson
Date: Sun, 11 Aug 2019 21:51
Date: Sun, 11 Aug 2019 21:51
138 lines
5806 bytes
5806 bytes
Benjamin Esham <usenet@esham.io> wrote:
> Is there a way to get slrn to apply my scores as soon as it
> retrieves the new articles from the server?
Yes, but once you see how much time this takes to do you probably
won't want to do this and you'll probably decide that it's okay that
slrn occasionally tells you that your scorefile killed all unread
articles.
A macro (such as the one below) will do what you want by visiting each
newsgroup on startup or on fetching new news, marking all articles
unread, and then quitting back to group mode.
This will make slrn process your scores and leave you with an unread
article count that takes into account the articles you've killed thus
giving you a more accurate group unread count.
To install this, copy the following (between the verbatim marks) into
a file (say "show_unkilled_group_counts.sl" in your home directory),
and load the file by appending:
interpret "~/show_unkilled_group_counts.sl"
to your slrnrc file.
This should run automatically when you launch slrn and when you fetch
new news from group mode by pressing "G" (the default keybinding).
Be warned: this only runs quickly enough to avoid annoyance when you
have a very fast connection to your news server.
How fast? If you are running a local news cache or running slrn on the
same machine as your news server you'll probably not notice this
macro. The speed problem is inherent in the concept -- there's nothing
about fetching all the info needed to properly process a scorefile
that scales up well; the more groups you have listed in group mode,
the more data this macro makes a newsreader (not just slrn) fetch, so
the longer it takes to let you see the most accurate unread article
count.
Enjoy.
#v+
% Show Unkilled Group Counts by J.B. Nicholson (jbn@forestfield.org)
implements ("Show_Unkilled_Group_Counts");
% Make slrn show group mode article counts that take killed articles
% into account.
static define group_mode_startup_hook ()
{
% Enter every group in group mode, mark remaining (unkilled)
% articles unread and reset their score (in case another macro
% saves their score on leaving group mode).
variable
starting_newsgroup = current_newsgroup (),
starting_sorting_method = 0,
starting_query_read_group_cutoff = get_variable_value ("query_read_group_cutoff"),
starting_prefix_argument = get_prefix_arg();
if (starting_newsgroup == "") return;
reset_prefix_arg();
set_integer_variable ("query_read_group_cutoff", 0);
EXIT_BLOCK
{
% Leave the cursor where we started.
while (current_newsgroup != starting_newsgroup)
{
ifnot (group_search (starting_newsgroup)) break;
}
% Restore saved state.
set_integer_variable ("query_read_group_cutoff", starting_query_read_group_cutoff);
set_prefix_argument (starting_prefix_argument);
}
call ("bob");
do
{
ifnot (group_unread()) continue;
try
{
() = select_group();
}
% It's not clear how to distinguish between the user
% interrupting the transfer of article headers (where we want
% to cancel running this macro) or some other error such as
% all articles got killed by the scorefile (where we want to
% continue running this macro).
catch UserBreakError:
{
% Hopefully this catches the error when the user
% cancels running this macro.
_clear_error();
ifnot (is_group_mode()) call ("quit");
return;
}
catch AnyError:
{
% We'll keep going.
_clear_error();
ifnot (is_group_mode()) call ("quit");
continue;
}
if (is_group_mode()) continue;
if (get_variable_value ("confirm_actions") & 1) set_input_chars ("y");
call ("uncatchup_all");
call ("quit");
ifnot (is_group_mode())
throw (RunTimeError, "It's not clear why you're not in group mode now.");
}
while (group_down_n (1));
}
switch (register_hook ("group_mode_startup_hook", "Show_Unkilled_Group_Counts->group_mode_startup_hook"))
{ case 0: throw (InternalError, "slrn is not seeing the hook properly."); }
{ case 1: % This is real. System report: Everything is fine. Nothing is ruined. -HR
}
{ case 2: throw (InternalError, "slrn sees the hook as already registered."); }
{ case 3: throw (InternalError, "slrn is not seeing the function properly."); }
static define refresh_groups ()
{
% Update unread counts when we get new news (and possibly new
% newsgroups).
ifnot (is_group_mode())
throw (UsageError, "Show_Unkilled_Group_Counts->refresh_groups is not meant for use in article mode!");
call ("refresh_groups");
Show_Unkilled_Group_Counts->group_mode_startup_hook();
}
definekey ("Show_Unkilled_Group_Counts->refresh_groups", "G", "group");
#v-
Technical Details
Message-ID:
<slrnql13fe.fth.jbn@forestfield.org>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.(126883).mbox.7z!not-for-mailReferences:
<jz5shmva.tw3x3k@bdesham.net>Show Full Headers
Complete Article Headers
Message-ID: <slrnql13fe.fth.jbn@forestfield.org> Subject: Re: [slrn] Applying scores before entering groups Date: Sun, 11 Aug 2019 21:51:42 +0000 From: "J.B. Nicholson" <jbn@forestfield.org> References: <jz5shmva.tw3x3k@bdesham.net> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.(126883).mbox.7z!not-for-mail Newsgroups: news.software.readers Organization: solani.org Lines: 138 X-Trace: solani.org 1565560302 30404 127.0.0.43 (11 Aug 2019 21:51:42 GMT) X-Complaints-To: abuse@news.solani.org NNTP-Posting-Date: Sun, 11 Aug 2019 21:51:42 +0000 (UTC) User-Agent: slrn/1.0.3 (Linux) X-User-ID: eJwFwYEBwDAEBMCVSHiM03j2H6F3fqHoMDjM1xdzmCx9O9nScxmeVqLLI59MI8qCyxrYk/4BKxIRoA== Cancel-Lock: sha1:vNjYKnnmTYRzoOy0a9UbxLHC59k= X-Received-Bytes: 5677 X-Received-Body-CRC: 3516361278