🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.readers
2 messages
2 total messages Started by Rob Funk Thu, 28 May 1998 00:00
slrn needs trn-like thread handling
#41193
Author: Rob Funk
Date: Thu, 28 May 1998 00:00
36 lines
2369 bytes
After 6 years of happily using trn 3.x, I've been using slrn for the
past 5-6 months.  There are so many things I like better about slrn,
but I missed trn's thread handling too much, and last week I
tentatively switched to trn 4.  Now I miss much of the feel of slrn,
but like trn's thread handling, so I'm in a state of indecision....

I would switch back to slrn without hesitation if slrn had a thread
tree like trn.  While reading a post in trn, I can glance at the
corner of the screen and see the pattern of the thread tree.  I can
hit one key to see the parent, child, or sibling article, even if that
article was marked read in a previous session.  Slrn's thread display
isn't nearly as readable, and it's hard to move to another article
(other than the next or previous in the one-dimensional list), and
even harder to get to an already-read article that isn't listed.

<rant>
Also, slrn needs to lose the concept of the prefix argument.  Hitting
ESC and a number before a command is vaguely non-intuitive when the
number has some meaning to the command it's prefixing.  Hitting ESC-1
just to have a prefix argument for an overloaded key is not only
totally nonintuitive, but way too many keys to hit.  Yeah, emacs has
the C-u prefix argument facility too, but this is not something to be
proud of.
</rant>

With a little S-Lang work, the prefix argument could probably be
worked around... but is there any way to fix the thread user
interface?
-- 
============= R o b  F u n k =============|=========> funk+@osu.edu <=========
   "A microscope locked in on one point   |  rfunk@peri.acs.ohio-state.edu
Never sees what kind of room that it's in"|  rfunk@marvin.uts.ohio-state.edu
    -- Chris Mars, "Stuck in Rewind"  |http://er4www.eng.ohio-state.edu/~funkr

Re: slrn needs trn-like thread handling
#41214
Author: Dawn Owens-Nicholson
Date: Fri, 29 May 1998 00:00
221 lines
9543 bytes
Rob Funk wrote:
> With a little S-Lang work, the prefix argument could probably be
> worked around... but is there any way to fix the thread user
> interface?

You are correct about using S-Lang macros to bind the prefix
functionality to other keys, however, "fix[ing]" something requires
that thing to be broken first and slrn's thread display (even though
you don't like it) is functional and correct according to its
documentation.  Unfortunately for you, in the current version of slrn,
no S-Lang macro can modify the display in the way you want.  Perhaps
in a future version this will become possible.

You could make slrn jump to articles within a thread (read or not) by
using a macro to move the selection arrow within the thread (for the
unread articles) or parse the References: headers of various articles
in the thread and then jump around to those articles.  I'm not
familiar with trn's thread movement capabilities, so I can't be more
specific on what to do, but it sounds like you'd want to use
extract_article_header(), call("locate_header_by_msgid") and linked
lists.  The first is documented in the doc/README.macros file, the
second is a slrn intrinsic and implementing the third in S-Lang is
documented in S-Lang's doc/text/slang.txt file, in case you are
unfamiliar with slrn and S-Lang.

There are a couple of bugs in extract_article_header() and the
locate_header_by_msgid intrinsic you should know about since they will
impact your macro.  I've included workaround macros below to help you.

  * extract_article_header() in slrn 0.9.5.2 will prepend a space to
    the message-ID of an article depending on its read status.  It's
    easy to work around, use:

       strtrim (extract_article_header ("Message-ID"))

    instead.  The strtrim() will remove leading and trailing
    whitespace.  This problem might exist for other headers too,
    but I rarely need to extract other headers, so I haven't noticed
    everything yet.

  * locate_header_by_msgid will unnecessarily uncollapse collapsed
    thread displays.  If the article you're searching for is the
    first article of a collapsed thread, the thread will be
    uncollapsed before the arrow (or bar) is left on the article.
    This is easy to work around also, but it means not being able
    to use the intrinsic as freely as you might want.

  * locate_header_by_msgid will add an article to a header list if
    the article is not present in the list but it's on the server.
    This can be annoying if you only want to know if a header is
    present.  The enhanced_locate_article_by_msgid() workaround
    below should help with this.

These bugs have been reported, but they're far from show-stoppers.  If
you use the workaround macros, your macro might not work as fast as
you'd like on large header listings, but as they say, they work well
for me.



% Bugfix for slrn's extract_article_header()        % -*- slang -*-

% Fixes extract_article_header() for known problem areas

define bugfix_extract_article_header (header)
{
   if (header == "Message-ID")
     return (strtrim (extract_article_header (header)));
   else
     return (extract_article_header (header));
}

define bugfix_locate_header_by_msgid ()
{
   % With collapsed threads, the intrinsic 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");                          % 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));

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

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

% Enhanced version of slrn's locate_header_by_msgid()          % -*- slang -*-

define enhanced_locate_header_by_msgid ();  % needed for recursion!
define enhanced_locate_header_by_msgid () 
{
   % This intrinsic replacement is enhanced in the following ways:
   %
   % (1) It takes an optional message-ID argument:
   %     enhanced_locate_header_by_msgid ([String Message-ID, [Integer p]]);
   %
   % (2) It returns:
   %    -1 if the message-ID was not found in the existing list but *might* be
   %       on the server (I can't tell without getting permission to add the
   %       article to the header list or doing a potentially time-consuming
   %       save-state and restore-state operation).
   %     0 if the message-ID was not found.
   %     1 if the message-ID was found in the existing header list.
   %     2 if the message-ID was found and added to the header list.
   %
   % (3) It only uncollapses a thread when the desired message-ID is inside
   %     a collapsed thread. (functionality from bugfix_locate_header_by_msgid)
   %
   % (4) It takes an optional argument on whether the message-ID can be added
   %     to the list.  If the second argument is non-zero, permission to add
   %     is granted, zero means denied.  The default (if the second argument
   %     is unsupplied) is to grant permission to add.  Permission is not
   %     prompted (in order to remain compatible with the intrinsic) and both
   %     message-ID and permission-bit must be supplied as arguments to make
   %     the permission count.

   variable
     sought_message_ID, permission_to_add = 1,
     usage = sprintf ("Usage: Integer_Type %s ();\n" +
		      "       Integer_Type %s (String_Type message-ID);\n" +
		      "       Integer_Type %s (String_Type message-ID, Integer_Type permission)",
		      _function_name (), _function_name (), _function_name ());

   switch (_NARGS)
     { case (0) :
	sought_message_ID = strtrim (read_mini ("Enter Message-Id", "", ""));
	!if (strlen (sought_message_ID)) return ();
     }
     { case (1) : sought_message_ID = (); }
     { case (2) :
	permission_to_add = ();
	sought_message_ID = ();
     }
     {            error (usage); }

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

   call ("header_bob");

   % The do-while (outer) loop moves the pointer from thread to thread
   % while the for (inner) 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 (1);

	     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); % next article
	  }
     }
   while (header_down (1));                                % next thread

   eval (sprintf ("() = %s (\"%s\");",                     % recursive call to
		  _function_name (), starting_header));    % starting place
   
   % Here, we have a small problem -- until there is a way to remove a header
   % added to the header list without affecting its header_flags
   % (call("art_xpunge") only works on read headers), we have to check for
   % permission_to_add here.  Ideally, we could check after
   % call("locate_header_by_msgid"), remove the header then return(2).

   !if (permission_to_add) return (-1);

   % calling the non-buggy part -- either the header will not be found
   % (return 0) or it will be found and added to the article list (return 2)

   ERROR_BLOCK { return (0); }                             % don't clear error
   set_input_string (sought_message_ID);
   call ("locate_header_by_msgid");
   return (2);
}

Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads