🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #43252

[slrn] header_prev_unread -- a slrn macro that works like header_next_unread()

#43252
From: Dawn Owens-Nicholson
Date: Tue, 15 Sep 1998 00:00
52 lines
2185 bytes
This macro works like header_next_unread() except it moves the cursor in the
opposite direction.  I posted it because I thought some of you would find it
handy.

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.  header_prev_unread() is included there.

% The opposite of header_next_unread()        % -*- mode: slang; mode: fold -*-
%
% Copyright 1998 J.B. Nicholson-Owens
% Author: J.B. Nicholson-Owens
% Title: header_prev_unread
% Version: 1.0
% Requires: slrn 0.9.5.3 or greater, S-Lang 1.0 or greater

define header_prev_unread ()
{
   variable
     t_size = 0,
     starting_article = extract_article_header ("Message-ID"),
     starting_thread_was_collapsed = is_thread_collapsed ();

   while (header_up (1))
     {
	if (is_thread_collapsed ())
	  {
	     t_size = thread_size ();
	     uncollapse_thread ();
	     () = header_down (t_size - 1);      % move to end of thread

	     loop (t_size - 1)                   % skip read headers
	       {
		  !if (get_header_flags () & HEADER_READ) return (1);
		  () = header_up (1);
	       }

	     collapse_thread ();
	  }

	!if (get_header_flags () & HEADER_READ) return (1);
     }

   set_input_string (starting_article);
   call ("locate_header_by_msgid");
   if (starting_thread_was_collapsed) collapse_thread ();

   message ("No previous unread articles.");
   return (0);
}

Technical Details
Message-ID: <slrn6vthfq.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: <slrn6vthfq.11g.bluemoon@ux6.cso.uiuc.edu>
Subject: [slrn] header_prev_unread -- a slrn macro that works like header_next_unread()
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: 391457202
Organization: University of Illinois at Urbana-Champaign
User-Agent: slrn/0.9.5.3 (UNIX)
Newsgroups: news.software.readers
Summary: A macro for slrn to move the cursor to the previous unread header.