🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #43247

[slrn] prev_high_score -- a macro like slrn's intrinsic next_high_score

#43247
From: Dawn Owens-Nicholson
Date: Tue, 15 Sep 1998 00:00
90 lines
3245 bytes
This macro will let you go up the header list stopping at high scoring
articles along the way (or issuing an error message if there are no such
articles above the cursor).  This is exactly like slrn's intrinsic
next_high_score, except this macro goes up the header list, not down.

If you're going to use Looptastic (most recent version is in
<slrn6vthej.11g.bluemoon@ux6.cso.uiuc.edu>), you don't need to download
this.  prev_high_score() is included there.

% In a way, the opposite of next_high_score   % -*- mode: slang; mode: fold -*-
%
% Copyright 1998 J.B. Nicholson-Owens
% Author: J.B. Nicholson-Owens
% Title: prev_high_score
% Version: 1.0
% Requires: slrn 0.9.5.3 or greater, S-Lang 1.0 or greater

define prev_high_score ()                                               %{{{
{
   if (is_group_mode ())
     error (_function_name () + " doesn\'t work in group mode!");

   variable
     starting_article = extract_article_header ("Message-ID"),
     starting_thread_was_collapsed = is_thread_collapsed (),
     thread_head_article = "";

   USER_BLOCK0
     {
	if (get_header_flags () & HEADER_HIGH_SCORE)
	  {
	     if (is_article_visible ()) call ("scroll_dn");
	     return ();
	  }
     }

   USER_BLOCK1
     {
	set_input_string (starting_article);
	call ("locate_header_by_msgid");
	if (starting_thread_was_collapsed) collapse_thread ();
	error ("No more high scoring articles.");
     }

   % move cursor to the head of the thread
   collapse_thread ();
   uncollapse_thread ();
   thread_head_article = extract_article_header ("Message-ID");
   if (thread_head_article != starting_article)
     {
	set_input_string (starting_article);
	call ("locate_header_by_msgid");
	() = header_up (1);
	while (extract_article_header ("Message-ID") != thread_head_article)
	  {
	     X_USER_BLOCK0 ();
	     () = header_up (1);
	  }
	X_USER_BLOCK0 ();
     }
   if (starting_thread_was_collapsed) collapse_thread ();
   !if (header_up (1)) X_USER_BLOCK1 ();

   variable
     thread_was_collapsed = 0,
     t_size = 0,
     index = 0;

   do
     {
	thread_was_collapsed = is_thread_collapsed ();
	!if (thread_was_collapsed) collapse_thread ();
	t_size = thread_size ();
	uncollapse_thread ();
	() = header_down (t_size - 1);

	for (index = t_size; index; index--)
	  {
	     X_USER_BLOCK0 ();
	     if (index != 1) () = header_up (1);
	  }
	if (thread_was_collapsed) collapse_thread ();
     }
   while (header_up (1));
   X_USER_BLOCK1 ();
}

%}}}

Technical Details
Message-ID: <slrn6vthhh.11g.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

Show Full Headers
Complete Article Headers
Message-ID: <slrn6vthhh.11g.bluemoon@ux6.cso.uiuc.edu>
Subject: [slrn] prev_high_score -- a macro like slrn's intrinsic next_high_score
Date: Tue, 15 Sep 1998 00:00:00 +0000
From: bluemoon@ux6.cso.uiuc.edu (Dawn Owens-Nicholson)
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: 391457203
Organization: University of Illinois at Urbana-Champaign
User-Agent: slrn/0.9.5.3 (UNIX)
Newsgroups: news.software.readers
Summary: A macro for slrn that works like the intrinsic "next_high_score".