🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #40751

Re: Help with slrn, please

#40751
From: Dawn Owens-Nicholson
Date: Tue, 12 May 1998 00:00
135 lines
5523 bytes
Uwe Schuerkamp wrote:
> [I want to duplicate trn's `k' in slrn.  Trn's `k' means] mark
> entire thread as read and display next article

By "entire thread" did you mean the unread visible parent and children
articles of the current articles or just the unread visible children
articles?  I'll assume you meant the former.  By "next article" did
you mean next read or unread article?  I'll assume you meant unread
article to remain compatible with scoring and how slrn usually does
things.

I'm not familiar with trn's behavior, so I've tested the trn_style_k
macro only a little bit.

Heikki Kantola replied:
> Use following slang-macro:
> 
> 	define mark_whole_thread_unread ()
> 	{
> 	   collapse_threads ();
> 	   call ("undelete");
> 	}
> 	definekey ("mark_whole_thread_unread", "k", "article");

Actually, that won't mark anything as read or display the next
article.  I believe the code I've included below is one way to do it.
It's long because I included a macro to fix a bug in slrn's
locate_header_by_msgid intrinsic.  I've tried to preserve the thread
collapse display as well as mark the current thread (parent articles
included) read and read the next (unread) article.

> A similar command in slrn seems to be "esc d", but I cannot
> remap it to "k" because I cannot find the command in the 
> .slrnrc file. Also, Esc d doesn't show the next unread 
> article but requires another keypress like space or Enter.

ESC-d is bound to delete_thread.  Also, it marks the current article
plus all (visible) child articles as read, not the parent articles.

>  Score: 9000
> 	References: hoover@.*\.bertelsmann\.de		
> 
> On weak sides of that solution is also the fact it will be scoring
> followups to your followups ad infinitium... :-/

Maybe a more restrictive regex would work:

      References: ^<[^>]+my@posting\.address\.goes\.here> <[^>]+>$

This should only match direct followups (and it won't match your own
articles unless you followup to yourself).  In case anyone reading
doesn't know S-Lang regular expressions, I'm using "[^>]+" instead of
".+" for minimal matching.  The ".+" part of "<.+>" would match way
too much because ".+" is greedy.


% You need both bugfix_locate_header_by_msgid and trn_style_k macros for
% trn_style_k to work.

define bugfix_locate_header_by_msgid ()
{
   % With collapsed threads, the intrinsic locate_header_by_msgid will
   % unnecessarily uncollapse a thread (or collapse other uncollapsed
   % threads).  This function fixes that and only uses the non-buggy
   % portions of locate_header_by_msgid.  The bugs have been reported.

   variable sought_message_ID = read_mini ("Enter Message-Id", "", "");
   !if (strlen (sought_message_ID)) return ();

   variable starting_header = extract_article_header ("Message-ID");

   call ("header_bob");                        % go to top of article list

   % The do-while loop moves the pointer from thread to thread while the
   % inner for loop checks the articles in each thread.  The collapse
   % status of the display is only disturbed when the desired message-ID
   % is found inside a thread.
   do
     {
	variable
	  thread_was_collapsed = is_thread_collapsed (),
	  t_size = thread_size (),
	  position;

	for (position = 1; position <= t_size; position++)
	  {
	     if (sought_message_ID == extract_article_header ("Message-ID"))
	       return ();

	     if (position == 1) uncollapse_thread ();
	     else if (andelse
		       { position == t_size }  % at end of thread
		       { thread_was_collapsed })
	       collapse_thread ();

	     if (position != t_size) () = header_down (1);
	  }
     }
   while (header_down (1));

   set_input_string (starting_header);        % moving to starting place
   call ("locate_header_by_msgid");

   set_input_string (sought_message_ID);      % calling the non-buggy part
   call ("locate_header_by_msgid");
}

define trn_style_k ()
{
   variable                                   % save some state
       thread_was_collapsed = is_thread_collapsed (),
       starting_point = extract_article_header ("Message-ID");

   % "mark entire thread as read..."
   collapse_thread ();
   call ("delete");                           % "delete_thread" is OK here too

   set_input_string (starting_point);         % go to read thread
   bugfix_locate_header_by_msgid ();

   if (thread_was_collapsed)                  % restore thread collapse
      collapse_thread ();
   else
      uncollapse_thread ();

   call ("next");
   if (andelse
       { is_group_mode () == 0 }              % are we in article mode
       { is_article_visible () == 0 })        % AND article is invisible?
      call ("hide_article");                  % unhide it
}
definekey ("trn_style_k", "k", "article");

Technical Details
Message-ID: <slrn6lhgof.7fh.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: <slrn6lgf0g.hc4.hoover@ente.highway.bertelsmann.de> <slrn6lgipk.ija.hezu@tuuri.ling.helsinki.fi>

Show Full Headers
Complete Article Headers
Message-ID: <slrn6lhgof.7fh.bluemoon@ux6.cso.uiuc.edu>
Subject: Re: Help with slrn, please
Date: Tue, 12 May 1998 00:00:00 +0000
From: bluemoon@ux6.cso.uiuc.edu (Dawn Owens-Nicholson)
References: <slrn6lgf0g.hc4.hoover@ente.highway.bertelsmann.de> <slrn6lgipk.ija.hezu@tuuri.ling.helsinki.fi>
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: 352681873
Organization: University of Illinois at Urbana-Champaign
Newsgroups: news.software.readers