Article View: news.software.readers
Article #49035Re: [slrn macro] End of Thread?
From: Thomas Schultz
Date: Thu, 03 Jun 1999 00:00
Date: Thu, 03 Jun 1999 00:00
71 lines
2699 bytes
2699 bytes
On 30 May 1999, Dawn Owens-Nicholson <bluemoon@ux6.cso.uiuc.edu> wrote:
> This will return boolean depending on whether the cursor is at the end of
> the thread or not.
Thank you; with your help, I finally was able to write a macro that
will go to the next article which matches a given condition without
changing the toggled-/untoggled-status of the threads:
define next_article_matching (condition, err_msg)
{
if (is_group_mode ())
error (_function_name () + " doesn\'t work in group mode!");
variable n;
variable starting_article = extract_article_header("Message-ID");
variable thread_was_collapsed = is_thread_collapsed ();
uncollapse_thread();
forever % loop through article headers
{
for (n = thread_size(); n > 1; n--)
{
() = header_down(1);
if (eval(condition)) return;
}
if (is_at_end_of_thread())
{
if (thread_was_collapsed) collapse_thread;
!if (header_down(1)) break;
thread_was_collapsed = is_thread_collapsed ();
if (eval(condition)) return;
else
{
thread_was_collapsed = is_thread_collapsed ();
uncollapse_thread();
}
}
else
{
!if (header_down(1)) break;
if (eval(condition)) return;
}
}
% if no article is found, return to starting point and display error message
() = locate_header_by_msgid (starting_article, 0);
error (err_msg);
}
An example of its use is the following function that will go to the
next article which has a positive score:
define next_pos_score ()
{
next_article_matching("get_header_score () > 0", "No more articles with a positive score.");
}
I hope this will also be useful for others; suggestions about what
could still be improved are welcome.
--
Kind regards,
Thomas Schultz
Technical Details
Message-ID:
<slrn7ld83l.u9.tststs@starflower.tststs.ddns.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.mbox.zip!not-for-mailReferences:
<slrn7ku79b.16m.tststs@starflower.tststs.ddns.org> <slrn7l103g.qd8.bluemoon@ux6.cso.uiuc.edu>Show Full Headers
Complete Article Headers
Message-ID: <slrn7ld83l.u9.tststs@starflower.tststs.ddns.org> Subject: Re: [slrn macro] End of Thread? Date: Thu, 03 Jun 1999 00:00:00 +0000 From: tststs@gmx.de (Thomas Schultz) References: <slrn7ku79b.16m.tststs@starflower.tststs.ddns.org> <slrn7l103g.qd8.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 X-Deja-AN: 485366261 X-Server-Date: 3 Jun 1999 19:00:14 GMT X-Trace: news2.cityweb.de 928436509 62.52.148.32 (Thu, 03 Jun 1999 21:01:49 MET DST) Organization: Pinguin online User-Agent: slrn/0.9.5.6 (UNIX) NNTP-Posting-Date: Thu, 03 Jun 1999 21:01:49 MET DST Newsgroups: news.software.readers