Article View: news.software.readers
Article #36124[slrn] bugfix macro for locate_header_by_msgid
From: J.B. Nicholson-Owens
Date: Wed, 17 Sep 1997 00:00
Date: Wed, 17 Sep 1997 00:00
76 lines
2954 bytes
2954 bytes
A problem: The slrn built-in "locate_header_by_msgid" uncollapses threads
unnecessarily.
A demonstration:
(1) enter a newsgroup with at least one collapsed thread and move the
pointer to the top header in that thread.
(2) execute: message (extract_article_header ("Message-ID")); then save
the message-ID you get in the copy buffer or write it down.
(3) move the pointer somewhere else.
(4) execute: call ("locate_header_by_msgid"); and enter the message-ID
you saved in step 2.
(5) the pointer moves to the correct place, but notice how that thread is
now uncollapsed?
A solution: I've written a macro to fix this. Use
bugfix_locate_header_by_msgid instead of
"call("locate_header_by_msgid");" and things should work fine
(unless you've coded expecting the bug).
% a bugfix replacement for call("locate_header_by_msgid") % -*- slang -*-
define bugfix_locate_header_by_msgid ()
{
% With collapsed articles, locate_header_by_msgid will unnecessarily uncollapse a
% thread. This function fixes that and only uses the non-buggy portions of
% locate_header_by_msgid.
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"); % top of article list
do
{
variable
thread_was_collapsed = is_thread_collapsed (),
t_size = thread_size ();
_for (1, t_size, 1)
{
variable position = ();
if (case (sought_message_ID, extract_article_header ("Message-ID")))
return ();
if (position == 1)
uncollapse_thread ();
else if (andelse
{ position == t_size; }
{ thread_was_collapsed; })
collapse_thread ();
if (position != t_size)
() = header_down (1);
}
}
while (header_down (1));
set_input_string (starting_header);
call ("locate_header_by_msgid"); % moving to starting place
set_input_string (sought_message_ID);
call ("locate_header_by_msgid"); % calling the non-buggy part
}
Technical Details
Message-ID:
<slrn61uolb.96.jbn@pop-a-wheelie.midwest.net>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-mailShow Full Headers
Complete Article Headers
Message-ID: <slrn61uolb.96.jbn@pop-a-wheelie.midwest.net> Subject: [slrn] bugfix macro for locate_header_by_msgid Date: Wed, 17 Sep 1997 00:00:00 +0000 From: jbn@pop-a-wheelie.midwest.net (J.B. Nicholson-Owens) 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: 273192622 Summary: A macro to be used instead of slrn (v0.9.4.3)'s locate_header_by_msgid Keywords: slrn, macro, bug fix, 0.9.4.3 Organization: Organizing Organisms & Organs Newsgroups: news.software.readers