🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #41835

Re: [SLRN] mark following article as read?

#41835
From: Dawn Owens-Nicholson
Date: Tue, 30 Jun 1998 00:00
143 lines
5022 bytes
Parand Tony Darugar <tdarugar@binevolve.com> wrote:
>   Is there a good way to mark articles the are below the cursor
> as read?

You could do the things you ask for in a S-Lang macro.  Read
slrn/doc/README.macros and the S-Lang intro in slang/doc/ for info on
slrn's S-Lang API and an intro to S-Lang, respectively.  The following
is not completely accurate, but it's quick:

define catchup_below ()
{
   call ("catchup_all");     % bound to "c" by default
   call ("uncatchup");       % bound to "\eU" by default
   call ("undelete");        % bound to "u" by default
}

Put this function in a file, interpret it from your slrn.rc (with the
"interpret" command) or from another S-Lang file (with evalfile()) and
bind a key to it to make all three actions happen with one keystroke.

> This comes in handy because with the score file in place most
> articles of interest appear at the top, and after some point
> the remainder is mostly junk.

You could score the junk with a kill score (-9,999 by default) and
never see the junk to begin with.

> Better yet, is it possible to mark a range of articles, and perform
> operations on them?

You could make macros that use slrn's numeric tagging (and you get
ordered tagging for free) by doing something like this:

define ordered_numeric_tags_processing ()
{
   variable 
     n = 1,
     starting_place = extract_article_header ("Message-ID");

   do
     {
        call ("header_bob");

        if (get_header_tag_number () == n)
          {
             % ...do something here...

             n++;
          }
     }
   while (header_down (1));

   set_input_string (starting_place);
   call ("locate_header_by_msgid");
}  

> That is, instead of individually tagging an article, can I place a
> marker at one point, scroll a couple of pages down, set a second
> marker, and perform some operation on the region between the two
> markers (eg. mark them as read)?

Sure, it might look like this:

define between_numeric_tags_processing ()
{
   variable starting_place = extract_article_header ("Message-ID");

   call ("header_bob");
   do
     {
        if (get_header_tag_number ())
          {
             () = header_down (1);
             while (get_header_tag_number () == 0)
               call ("delete");
             break;
          }
     }
   while (header_down (1));

   set_input_string (starting_place);
   call ("locate_header_by_msgid");
}

This code will enter an endless loop if there's only one header tag
number in the header list, but I think it's sufficient to get the idea
across that you can do a number of things with slrn's macros.

>   While I'm at it, is there a way to tell slrn to mark all 
> articles that have a particular word/phrase in them as read?

Yes, but any processing of article contents is a high-bandwidth
operation.  I wouldn't do this if you aren't using a fast connection
to your news server.  If article body scoring becomes available, I
recommend you use that instead of a macro (the compiled C code will be
faster).  Your macro could look like this:

define mark_read_on_content (regex)
{  
   variable
     articles_marked_read = 0,
     starting_place = extract_article_header ("Message-ID");

   call ("header_bob");

   do
     {
        variable
          article_body = article_as_string (),
          article_line = "",
          n = 0;

        while (article_line = extract_element (article_body, n, '\n'),
               article_line != NULL)
          {
             if (string_match (regex, article_line, 0))
               {
                  set_header_flags (get_header_flags () | HEADER_READ);
                  articles_marked_read++;
               }

             n++;
          }
     }
   while (header_down (1));

   set_input_string (starting_place);
   call ("locate_header_by_msgid");
}

None of the code examples are tested and none will handle collapsed
threads properly, but I think they convey enough so that you get the
idea of what's going on.  They all try to store where you called the
function, do some operation and put the arrow (or bar) where it began.

The last example is a function that takes a regular expression for an
argument.  I'll leave it to you to look up what regex constructs
S-Lang supports.

I hope this helps you!

Technical Details
Message-ID: <slrn6pinrr.25o.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-mail
References: <35992446.F7165815@binevolve.com>

Show Full Headers
Complete Article Headers
Message-ID: <slrn6pinrr.25o.bluemoon@ux6.cso.uiuc.edu>
Subject: Re: [SLRN] mark following article as read?
Date: Tue, 30 Jun 1998 00:00:00 +0000
From: bluemoon@ux6.cso.uiuc.edu (Dawn Owens-Nicholson)
References: <35992446.F7165815@binevolve.com>
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: 367554639
Organization: University of Illinois at Urbana-Champaign
Newsgroups: news.software.readers