🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.readers
22 messages
22 total messages Started by he... Heikki Kantola Mon, 12 Apr 1999 00:00
Slrn: marking article/thread read without moving to next unread?
#47958
Author: he... Heikki Kantola
Date: Mon, 12 Apr 1999 00:00
15 lines
1392 bytes
I've started to write a S-Lang macro, which would just mark article/
thread and not jump to next unread after that as I occasionally want
browse some groups with large trafic starting from the end of the
article listing. I've figured out how to set one article read (by
using "set_header_flags(HEADER_READ)" without movement), but is there
any easy way to mark whole threads read without resorting to use
internal "delete"-function?

-- 
Heikki "Hezu" Kantola, <Heikki...@IKI.FI>
Lähettämällä mainoksia tai muuta asiatonta sähköpostia yllä olevaan
osoitteeseen sitoudut maksamaan oikolukupalvelusta FIM500 alkavalta
tunnilta.
Re: Slrn: marking article/thread read without moving to next unread?
#47941
Author: da... John E. Davis
Date: Mon, 12 Apr 1999 00:00
21 lines
1358 bytes
On 12 Apr 99 16:14:03 GMT, Peppe <c92...@student.dtu.dk>
wrote:
>        variable n = thread_size () - 1;
>        while (n, n--)
>        {
>          () = header_down (1);
>          set_header_flags (HEADER_READ);
>        }

A S-Lang tip: It is probably better to code this using a `loop'
statement:

        loop (thread_size () - 1)
        {
          () = header_down (1);
          set_header_flags (HEADER_READ);
        }

--John
Re: Slrn: marking article/thread read without moving to next unread?
#47956
Author: c92... Peppe
Date: Mon, 12 Apr 1999 00:00
36 lines
2146 bytes
Thus wrote Heikki Kantola <he...@iki.fi>
> I've started to write a S-Lang macro, which would just mark article/
> thread and not jump to next unread after that as I occasionally want
> browse some groups with large trafic starting from the end of the
> article listing. I've figured out how to set one article read (by
> using "set_header_flags(HEADER_READ)" without movement), but is there
> any easy way to mark whole threads read without resorting to use
> internal "delete"-function?

How about the following function (only undergone a quick test):

    define delete_enhanced ()
    {
      set_header_flags (HEADER_READ);
      if (is_thread_collapsed ())
      {
        uncollapse_thread ();
        variable n = thread_size () - 1;
        while (n, n--)
        {
          () = header_down (1);
          set_header_flags (HEADER_READ);
        }
        collapse_thread ();
      }
    }
    definekey ("delete_enhanced", "d", "article");

Peppe
-- 
Let us drink a toast to all we love the best.  __/-\__         Preben Guldberg
We will sleep through all the lectures,         (o o)   c92...@student.dtu.dk
And cheat on the exams, and we'll pass      oOOo (_) oOOo---------------------
and be forgotten with the rest.           --Tom Lehrer: Bright College Days
Re: Slrn: marking article/thread read without moving to next unread?
#47966
Author: c92... Peppe
Date: Tue, 13 Apr 1999 00:00
23 lines
1675 bytes
Thus wrote Heikki Kantola <he...@iki.fi>
> Ok, after those hints, I managed to create the macro and in case
> somebody else is also interested in it, here it is in its full glory:

>      if (is_group_mode ())
>        error (_function_name () + " doesn't work in group mode!");
>      set_header_flags(HEADER_READ);
>      if(thread_size() > 1) {
[...]
> 	header_up(1);
> 	collapse_thread ();
>      }

Why the header_up(1)? It seems superfluous to me.

Peppe
-- 
Preben Guldberg          __/-\__
c92...@student.dtu.dk    (o o)       "It's no joke. It's a rope, Tuco."
----------------------oOOo (_) oOOo   --Il buono
http://www.student.dtu.dk/~c928400/   --_Il buono, il brutto, il cattivo_
Re: Slrn: marking article/thread read without moving to next unread?
#47975
Author: he... Heikki Kantola
Date: Tue, 13 Apr 1999 00:00
50 lines
2284 bytes
John E. Davis <da...@space.mit.edu> informed
news.software.readers with the following:
>On 12 Apr 99 16:14:03 GMT, Peppe <c92...@student.dtu.dk>
>wrote:
>>        variable n = thread_size () - 1;
>>        while (n, n--)
>>        {
>>          () = header_down (1);
>>          set_header_flags (HEADER_READ);
>>        }
>
>A S-Lang tip: It is probably better to code this using a `loop'
>statement:
>
>        loop (thread_size () - 1)
>        {
>          () = header_down (1);
>          set_header_flags (HEADER_READ);
>        }

Ok, after those hints, I managed to create the macro and in case
somebody else is also interested in it, here it is in its full glory:

 % mark article/thread read without jumping to next unread.
 define mark_read() 
  {
     variable status;
     
     if (is_group_mode ())
       error (_function_name () + " doesn't work in group mode!");
     set_header_flags(HEADER_READ);
     if(thread_size() > 1) {
        uncollapse_thread ();
	loop(thread_size() - 1) {
	  () = header_down(1);
	  set_header_flags(HEADER_READ);
	} 
	header_up(1);
	collapse_thread ();
     }
  }
 definekey("mark_read","D","article");

-- 
Heikki "Hezu" Kantola, <Heikki...@IKI.FI>
Lähettämällä mainoksia tai muuta asiatonta sähköpostia yllä olevaan
osoitteeseen sitoudut maksamaan oikolukupalvelusta FIM500 alkavalta
tunnilta.
Re: Slrn: marking article/thread read without moving to next unread?
#48005
Author: he... Heikki Kantola
Date: Wed, 14 Apr 1999 00:00
28 lines
1924 bytes
Peppe <c92...@student.dtu.dk> informed
news.software.readers with the following:
>Thus wrote Heikki Kantola <he...@iki.fi>
>> Ok, after those hints, I managed to create the macro and in case
>> somebody else is also interested in it, here it is in its full glory:
>
>>      if (is_group_mode ())
>>        error (_function_name () + " doesn't work in group mode!");
>>      set_header_flags(HEADER_READ);
>>      if(thread_size() > 1) {
>[...]
>> 	header_up(1);
>> 	collapse_thread ();
>>      }
>
>Why the header_up(1)? It seems superfluous to me.

You're correct, I think it was left there as I for a while tried to
make the loop without detracting 1 from thread size and then moving up
would be needed to compensate that...
 
-- 
Heikki "Hezu" Kantola, <Heikki...@IKI.FI>
Lähettämällä mainoksia tai muuta asiatonta sähköpostia yllä olevaan
osoitteeseen sitoudut maksamaan oikolukupalvelusta FIM500 alkavalta
tunnilta.
Re: Slrn: marking article/thread read without moving to next unread?
#48023
Author: c92... Peppe
Date: Thu, 15 Apr 1999 00:00
56 lines
2667 bytes
Thus wrote Srinivasa SA <s...@hpprobe.div111.bell-labs.com>
> I was searching for the thread-kill function for slrn in the
> newsgroup and found yours:

> But the macro you gave didn't work. 
> Any hints?

[--- snip --- errors ---]

> I put the following code in .slrnrc:

> %
> % mark article/thread read without jumping to next unread.
> % From: he...@iki.fi (Heikki Kantola)
> % Date: 13 Apr 1999 09:10:15 GMT
> %
> define mark_thread_read() 
> {
> 	variable status;

> 	if (is_group_mode ())
> 	error (_function_name () + " doesn't work in group mode!");
> 	set_header_flags(HEADER_READ);
> 	if(thread_size() > 1) 

This should be "if(is_thread_collapsed())" instead. thread_size() may
return values higher than one for subthreads of an uncollapsed thread.

> 	{
> 		uncollapse_thread ();
> 		loop(thread_size() - 1) 
> 		{
> 			() = header_down(1);
> 			set_header_flags(HEADER_READ);
> 		} 
> 		collapse_thread ();
> 	}
> }
> definekey("mark_thread_read","D","article");

Functions like these are not regular slrn commands. They are s-lang
functions that needs to be interpreted seperately. To do so, put the
function(s) in a seperate file, eg. .slrn.sl. Now add

    interpret .slrn.sl

to your .slrnrc.

Peppe
-- 
[...] a theory I have held for some       __/-\__         Preben Guldberg
time, to the effect that the reason        (o o)   c92...@student.dtu.dk
most folk songs are so atrocious is    oOOo (_) oOOo---------------------
that they were written by the people.    --Tom Lehrer: Clementine (intro)
Re: Slrn: marking article/thread read without moving to next unread?
#48038
Author: Sylvan Butler
Date: Thu, 15 Apr 1999 00:00
14 lines
1494 bytes
On 15 Apr 1999 00:14:18 GMT, Srinivasa SA <s...@hpprobe.div111.bell-labs.com> wrote:
>slrn 0.9.4.3 (Sep 16 1998 00:18:17)

You probably need a current version of slrn (9.5.4).

sdb
-- 
 | Sylvan Butler | Not speaking for Hewlett-Packard | sbutler-boi.hp.com |
 | Watch out for my e-mail address. Thank UCE.   #### change ^ to @ #### |
    They that can give up essential liberty to obtain a little temporary
    safety deserve neither liberty nor safety. --Benjamin Franklin, 1759
 "Don't Tread On Me!"
Re: Slrn: marking article/thread read without moving to next unread?
#48040
Author: s... Srinivasa SA
Date: Thu, 15 Apr 1999 00:00
59 lines
2294 bytes
On 14 Apr 1999 07:16:50 GMT, Heikki Kantola <he...@iki.fi> wrote:
>Peppe <c92...@student.dtu.dk> informed
>news.software.readers with the following:
>>Thus wrote Heikki Kantola <he...@iki.fi>
>>> Ok, after those hints, I managed to create the macro and in case
>>> somebody else is also interested in it, here it is in its full glory:


I was searching for the thread-kill function for slrn in the
newsgroup and found yours:

But the macro you gave didn't work. 
Any hints?

The error msg:

~~~~~~~~~~~~
$slrn
slrn 0.9.4.3 (Sep 16 1998 00:18:17)
Reading startup file /usr/lib/slrn/slrn.rc.
Reading startup file /home/sas/.slrnrc.
S-Lang Error: define: invalid command.: Unknown Error.
slrn fatal error:
/home/sas/.slrnrc: Error encountered processing line 8
define mark_thread_read()
~~~~~~~~~~~~

I put the following code in .slrnrc:

%
% mark article/thread read without jumping to next unread.
% From: he...@iki.fi (Heikki Kantola)
% Date: 13 Apr 1999 09:10:15 GMT
%
define mark_thread_read() 
{
	variable status;

	if (is_group_mode ())
	error (_function_name () + " doesn't work in group mode!");
	set_header_flags(HEADER_READ);
	if(thread_size() > 1) 
	{
		uncollapse_thread ();
		loop(thread_size() - 1) 
		{
			() = header_down(1);
			set_header_flags(HEADER_READ);
		} 
		collapse_thread ();
	}
}
definekey("mark_thread_read","D","article");

% end of mark_thread_read


Re: Slrn: marking article/thread read without moving to next unread?
#48042
Author: blue... Dawn Owens-Nicholson
Date: Thu, 15 Apr 1999 00:00
27 lines
1681 bytes
Heikki Kantola wrote:
> I've started to write a S-Lang macro, which would just mark article/
> thread and not jump to next unread [...]

In the spirit of TMTOWTDI, here's another (almost entirely self-documenting)
way to do it:

define mark_thread_read_stand_still ()
{
   variable
     starting_article = extract_article_header ("Message-ID"),
     thread_was_collapsed = is_thread_collapsed ();

   call ("delete_thread");
   set_input_string (starting_article);          % go back to where we started
   call ("locate_header_by_msgid");              % lhbm is slightly buggy
   if (thread_was_collapsed) collapse_thread (); % restore thread collapse
   else uncollapse_thread ();                    % to work around lhbm bug
}

> [...] but is there any easy way to mark whole threads read without
> resorting to use internal "delete"-function?

Why not use the intrinsic functions?  They're usually faster, your code can
be shorter and you don't have to reinvent wheels.
Re: Slrn: marking article/thread read without moving to next unread?
#48043
Author: i... Ian T Zimmerman
Date: Fri, 16 Apr 1999 00:00
23 lines
2046 bytes
In article <slrn7hac...@hpprobe.div111.bell-labs.com>
s...@hpprobe.div111.bell-labs.com (Srinivasa SA) writes:

>  I was searching for the thread-kill function for slrn in the
> newsgroup and found yours:
>  But the macro you gave didn't work.  Any hints?

As other have already pointed out, you've tried putting a slang macro
in the slrn startup file, but this file is not for slang but rather
for the primitive slrn configuration "language".

I have often wondered why the .slrnrc "language" is needed at all.  As
all special configuration languages, it is ugly and inconsistent
(e.g. why do some parameters require "set foo bar" and others just
"foo bar"?).  Why not simply interpret a slang file by default?

-- 
Ian T Zimmerman                         <i...@transbay.net>
The world has taken on a thickness of vulgarity
that raises a spiritual man's contempt to the violence
of a passion.                           Charles Baudelaire
Re: Slrn: marking article/thread read without moving to next unread?
#48045
Author: lah... Jan Hlavacek
Date: Fri, 16 Apr 1999 00:00
39 lines
3118 bytes
On Fri, 16 Apr 1999 04:36:55 GMT, Ian T Zimmerman
<i...@kronstadt.transbay.net> wrote:
> In article <slrn7hac...@hpprobe.div111.bell-labs.com>
> s...@hpprobe.div111.bell-labs.com (Srinivasa SA) writes:
> 
> >  I was searching for the thread-kill function for slrn in the
> > newsgroup and found yours:
> >  But the macro you gave didn't work.  Any hints?
> 
> As other have already pointed out, you've tried putting a slang macro
> in the slrn startup file, but this file is not for slang but rather
> for the primitive slrn configuration "language".
> 
> I have often wondered why the .slrnrc "language" is needed at all.  As
> all special configuration languages, it is ugly and inconsistent
> (e.g. why do some parameters require "set foo bar" and others just
> "foo bar"?).  Why not simply interpret a slang file by default?

If you look at the changes.txt file,  you will see that prior version
0.8.8.4, S-Lang interpreter was not available in slrn.  If I am not
mistaken, you can still compile slrn without the interpreter. 

As for the incositencies, there are none.  The slrnrc language is very
simple. It has only about 7 or so commands.  I have the complete list
somewhere,  but right now I can't find it,  so just of top of my head:
hostname, interpret, set, color, mono, key, server.  The `set' command
sets variables.  So if you see "foo bar", the "foo" is a command and
"bar" is a parameter.  If you see "set foo bar", "set" is the command,
"foo" is a name of a variable, and "bar" is a value.

There used to be more commands,  lot of then changed into variables.  

-- 
Jan Hlav\'{a}\v{c}ek <lah...@math.mps.ohio-state.edu>  (BCC's will bounce)
home page: http://www.math.ohio-state.edu/~lahvak/
slrn page: http://www.math.ohio-state.edu/~lahvak/software/slrn.html
slrn documentation: http://www.math.ohio-state.edu/~lahvak/software/slrn/
Re: Slrn: marking article/thread read without moving to next unread?
#48047
Author: he... Heikki Kantola
Date: Fri, 16 Apr 1999 00:00
43 lines
2509 bytes
Dawn Owens-Nicholson <blue...@ux6.cso.uiuc.edu> informed
news.software.readers with the following:
>Heikki Kantola wrote:
>> I've started to write a S-Lang macro, which would just mark article/
>> thread and not jump to next unread [...]
>
>In the spirit of TMTOWTDI, here's another (almost entirely self-documenting)
>way to do it:
>
>define mark_thread_read_stand_still ()
>{
>   variable
>     starting_article = extract_article_header ("Message-ID"),
>     thread_was_collapsed = is_thread_collapsed ();
>
>   call ("delete_thread");
>   set_input_string (starting_article);          % go back to where we started
>   call ("locate_header_by_msgid");              % lhbm is slightly buggy
>   if (thread_was_collapsed) collapse_thread (); % restore thread collapse
>   else uncollapse_thread ();                    % to work around lhbm bug
>}

I would say that's uglier than what I resorted to use (see <URL:news:
slrn7h62...@tuuri.ling.helsinki.fi>) as locating by msg-id
sounds somewhat slow to me...

>> [...] but is there any easy way to mark whole threads read without
>> resorting to use internal "delete"-function?
>
>Why not use the intrinsic functions?  They're usually faster, your code can
>be shorter and you don't have to reinvent wheels.

You're propably right and I've nothing against using intrisic functions, 
although using the internal functions occasionally can also save few 
lines of code.

-- 
Heikki "Hezu" Kantola, <Heikki...@IKI.FI>
Lähettämällä mainoksia tai muuta asiatonta sähköpostia yllä olevaan
osoitteeseen sitoudut maksamaan oikolukupalvelusta FIM500 alkavalta
tunnilta.
Re: Slrn: marking article/thread read without moving to next unread?
#48053
Author: c92... Peppe
Date: Fri, 16 Apr 1999 00:00
35 lines
2283 bytes
Thus wrote Dawn Owens-Nicholson <blue...@ux6.cso.uiuc.edu>
> Peppe wrote:
> > This should be "if(is_thread_collapsed())" instead. [...]

> I don't know if you knew this but if you want to mark collapsed threads read
> or unread, the delete (or delete_thread) and undelete intrinsics work
> quickly.

Yep, I know these. The question was for a solution that did not use
the internal "delete", though. On my way, I was unforunately relying
on the erroneous use of set_header_flags().

Where I to use "delete", the function might be

    define delete_thread_stay_put ()
    {
        collapse_thread ();
        if (header_down (1))
        {
            header_up (1);
            call ("delete")
            header_up (1);
        }
        else
            call ("delete")
    }

Peppe
-- 
Preben Guldberg          __/-\__       Q. How many Microsoft engineers does
c92...@student.dtu.dk    (o o)           it take to change a light bulb?
----------------------oOOo (_) oOOo    A. None. They just change the
http://www.student.dtu.dk/~c928400/       standard to darkness.
Re: Slrn: marking article/thread read without moving to next unread?
#48061
Author: blue... Dawn Owens-Nicholson
Date: Fri, 16 Apr 1999 00:00
28 lines
2052 bytes
Peppe wrote:
> Where I to use "delete", the function might be
> 
>     define delete_thread_stay_put ()
>     {
>         collapse_thread ();
>         if (header_down (1))
>         {
>             header_up (1);
>             call ("delete")
>             header_up (1);
>         }
>         else
>             call ("delete")
>     }

Actually, there are some problems with this.  It marks read the entire
available thread instead of the subthread the user may have wanted to mark
read.  Moving the cursor with call("delete") can't be compensated by
"() = header_up (1)" (which is what I think you meant to say) because the
delete intrinsic doesn't strictly move the cursor down one header.

The original question asked to avoid using the intrinsics, but there's no
good reason to avoid the delete_thread intrinsic.  Also, there's a big
disadvantage to using a loop to put the cursor back where it started instead
of using the locate_header_by_msgid intrinsic.
Re: Slrn: marking article/thread read without moving to next unread?
#48069
Author: blue... Dawn Owens-Nicholson
Date: Fri, 16 Apr 1999 00:00
14 lines
1342 bytes
Heikki Kantola wrote:
>      set_header_flags(HEADER_READ);

Unfortunately this will clobber any existing header flags (HEADER_TAGGED,
HEADER_HIGH_SCORE or HEADER_LOW_SCORE as of slrn v0.9.5.4). I think you
should either use the delete_thread intrinsic (which will do much of what
you want the whole macro to do, and scale better) or use

   set_header_flags (get_header_flags () | HEADER_READ);

to preserve the header flags already set.  This is one of those bugs that
might not come up for a while because it is so subtle.
Re: Slrn: marking article/thread read without moving to next unread?
#48073
Author: blue... Dawn Owens-Nicholson
Date: Fri, 16 Apr 1999 00:00
10 lines
1237 bytes
Peppe wrote:
> This should be "if(is_thread_collapsed())" instead. [...]

I don't know if you knew this but if you want to mark collapsed threads read
or unread, the delete (or delete_thread) and undelete intrinsics work
quickly.

Happy newsreading!
Re: Slrn: marking article/thread read without moving to next unread?
#48088
Author: c92... Peppe
Date: Sat, 17 Apr 1999 00:00
61 lines
3655 bytes
Thus wrote Dawn Owens-Nicholson <blue...@ux6.cso.uiuc.edu>
> Peppe wrote:
> > Where I to use "delete", the function might be

> >     define delete_thread_stay_put ()
> >     {
> >         collapse_thread ();
> >         if (header_down (1))
> >         {
> >             header_up (1);
> >             call ("delete")
> >             header_up (1);
> >         }
> >         else
> >             call ("delete")
> >     }

> Actually, there are some problems with this.  It marks read the entire
> available thread instead of the subthread the user may have wanted to mark
> read.

Perhaps it is just me, but to me there is a strong distinction between
thread and subthread. So when someone asks for a way to delete a
thread, I whack the whole thread.

> Moving the cursor with call("delete") can't be compensated by
> "() = header_up (1)" (which is what I think you meant to say) because the
> delete intrinsic doesn't strictly move the cursor down one header.

Excactly what the purpose of the "if header_down (1)" test was for.
Are there cases where this test will fail?

> The original question asked to avoid using the intrinsics, but there's no
> good reason to avoid the delete_thread intrinsic.

Except that it may only delete subthread, depending on which article
in the thread you are on.

As I see it, one advantage of using the intrinsic functions, rather
than the internal ones (which I call with 'call("delete")' and so) is
that the internal functions may or may not move the cursor, depending
on position on the screen and other things (eg. numerically tagging
moves if not already tagged, stays put if it was).

> Also, there's a big
> disadvantage to using a loop to put the cursor back where it started instead
> of using the locate_header_by_msgid intrinsic.

Granted, the loop is an awkward hack. At one point I experienced
problems with locate_header_by_msgid, so I have avoided it since.
I should make further tests to get more comfortable with it, but in
the mean time I resort to work arounds.

Peppe
-- 
Preben Guldberg   c92...@student.dtu.dk   http://www.student.dtu.dk/~c928400/
  I don't like people to get the idea that I have to do this for a living.
  I mean, it isn't as though I had to do this, you know, I could be making,
  oh, 3000 dollars a year just teaching.          --Tom Lehrer: Lobachevsky
Re: Slrn: marking article/thread read without moving to next unread?
#48106
Author: blue... Dawn Owens-Nicholson
Date: Mon, 19 Apr 1999 00:00
92 lines
4922 bytes
Peppe wrote:
> 1   define delete_thread_stay_put ()
> 2   {
> 3       collapse_thread ();
> 4       if (header_down (1))
> 5       {
> 6           header_up (1);
> 7           call ("delete")
> 8           header_up (1);
> 9       }
> 10      else
> 11          call ("delete")
> 12  }

I numbered the lines for easy reference.  I'm including the macro here
because it's short.

I said:
> Moving the cursor with call("delete") can't be compensated by
> "() = header_up (1)" (which is what I think you meant to say) because the
> delete intrinsic doesn't strictly move the cursor down one header.

Peppe replied:
> Excactly what the purpose of the "if header_down (1)" test was for.
> Are there cases where this test will fail?

Yes, in this context, moving the cursor up or down one header will not work
because call("delete") leaves the cursor at the next unread header--the next
unread header isn't necessarily one header away from the deleted thread or
article--or doesn't move the cursor at all which means you can't forsee
where delete will put the cursor using header_down(1) like you're doing.
Here are some cases where your code fails:

* If there are only read headers below the cursor:

  Line 4: header_down(1) returns 1, so the block will execute.

  Line 6: leaves 1 on the stack (a bug) and the cursor will be put back
	  where it began.

  Line 7: The collapsed thread is marked as read causing the cursor to /stay
	  where it is/ because the delete intrinsic will not find an unread
	  header below.  This line also needs a semicolon at the end.

  Line 8: header_up(1) leaves 1 on the stack (bug) and the cursor one header
	  too high.

* If there are unread headers far below the thread being marked read, the
  macro fails:

  Lines 4-7: As above.

  Line 8: header_up(1) moves the cursor up one header and the cursor is left
	  somewhere in a thread that had nothing to do with anything.

Another case where this macro will fail that doesn't have to do with
header_up()/header_down():

* Marking the only uncollapsed thread in the display read.

  Lines 3-8: The thread is collapsed, marked read and /left collapsed/.

  I consider this a problem since the thread was uncollapsed to begin with
  and there's no need to leave the display differently than it started
  (here, it's only 3 lines of very easily-read code to make the macro work
  without disturbing the display).

There are cases where your macro works as intended, but clearly it is not
correct all the time.  Since there is a short, almost entirely
self-documenting macro that scales better and works correctly under all
header list layouts (even restoring thread collapse status appropriately) I
don't see the point in using the other approaches.

> As I see it, one advantage of using the intrinsic functions, rather
> than the internal ones (which I call with 'call("delete")' and so) is
> that the internal functions may or may not move the cursor, depending
> on position on the screen and other things (eg. numerically tagging
> moves if not already tagged, stays put if it was).

There aren't that many one-to-one matches between intrinsic and internal
functions, I can think of only a few that come /close/ to matching.  But the
real point is, I don't see how call()ed functions are inherently advantaged
or disadvantaged separate from the overall job.

> Granted, the loop is an awkward hack. At one point I experienced
> problems with locate_header_by_msgid, so I have avoided it since.

I'd like to know what problems you had.  I'm aware of a couple problems with
it, but neither have much to do with this thread (one problem I mentioned in
code comments in <slrn7hcdkv...@ux6.cso.uiuc.edu>).
Re: Slrn: marking article/thread read without moving to next unread?
#48117
Author: c92... Peppe
Date: Mon, 19 Apr 1999 00:00
28 lines
2380 bytes
Thus wrote Dawn Owens-Nicholson <blue...@ux6.cso.uiuc.edu>

[--- snip --- macro and possible failures ---]
> There are cases where your macro works as intended, but clearly it is not
> correct all the time.

I see. My tests have not been thourough enough.

> Peppe wrote:
> > Granted, the loop is an awkward hack. At one point I experienced
> > problems with locate_header_by_msgid, so I have avoided it since.

> I'd like to know what problems you had.

Too long ago, can't remember. Might have been lack of understanding
how it should be applied. After your explanations here, I will use
this instead as it should lead to more sound solutions.

Thanks for all the help and information throughout this thread.

Peppe
-- 
Preben Guldberg  c92...@student.dtu.dk  http://www.student.dtu.dk/~c928400
   __/-\__    Bill Gates, 1981:   Nobody will ever need more than 640k RAM!
    (o o)     Bill Gates, 1996:   Windows 95 needs at least 8 MB RAM.
oOOo (_) oOOo Logical conclusion: Nobody will ever need Windows 95.
slrn's locate_header_by_msgid and another deleting_thread without moving the cursor
#48119
Author: blue... Dawn Owens-Nicholson
Date: Mon, 19 Apr 1999 00:00
64 lines
4268 bytes
Peppe wrote:
> Too long ago, can't remember. Might have been lack of understanding
> how it should be applied. After your explanations here, I will use
> this instead as it should lead to more sound solutions.

Here's a couple things to look out for when using locate_header_by_msgid
(and the related goto_article):

* Unnecessarily uncollapsing threads--lhbm will uncollapse the thread even
  if it doesn't need to to put the cursor on the target article.  Check this
  out by lhbm-jumping to an article at the head of a collapsed thread.

* lhbm will cause a download--if you give lhbm the message-ID of an article
  not in the header list but on the server, that article will be added to
  the bottom of the current header list.

  Unfortunately, in some cases, this leaves you with an ambiguous situation:
  was the article I wanted at the bottom of the header list or was it just
  added to the header list?  Sometimes, you can resolve the dispute by
  checking out the Newsgroups: header or read status, sometimes you can't.

Unfortunately there's no good way to work around all of lhbm's shortcomings
in all situations.  I'm hoping slrn will someday allow S-Lang access to a
header tree data structure complete with all known info (read headers,
status, body availability, etc.) so macros can walk this tree instead of
manipulating the cursor as one does from a keyboard.  This would mean you
could lhbm-hop around the real header list and quickly know what is in the
header list and what isn't.

Unfortunately, interpreting the original request that started this thread to
mean "don't disturb the display at all" means there is a large price to pay
for marking lengthy threads as read with this macro (note the loop--unroll
it and see how much code is /really/ executed).  It makes me curious what
the larger role is for this macro (is there one?); maybe there's another way
to solve the bigger problem and use faster code?

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

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

   uncollapse_thread ();
   loop (thread_size ())                         % call("delete_thread")-ish
     {
	set_header_flags (get_header_flags () | HEADER_READ);
	() = header_down (1);                    % just because I'm lazy and
     }                                           % it's sufficiently terse

   set_input_string (starting_article);          % go back to where we started
   call ("locate_header_by_msgid");              % lhbm is slightly buggy
   if (thread_was_collapsed) collapse_thread (); % restore thread collapse
   else uncollapse_thread ();                    % to work around lhbm bug
}

It's virtually the same as the one I posted before, just the first call()
was replaced and the macro will issue a better error in group mode.

Happy newsreading!
Re: slrn's locate_header_by_msgid and another deleting_thread without moving the cursor
#48132
Author: da... John E. Davis
Date: Tue, 20 Apr 1999 00:00
67 lines
3802 bytes
On 19 Apr 1999 09:11:32 GMT, Dawn Owens-Nicholson <blue...@ux6.cso.uiuc.edu>
wrote:
>Here's a couple things to look out for when using locate_header_by_msgid
>(and the related goto_article):
>
>* Unnecessarily uncollapsing threads--lhbm will uncollapse the thread even

  0.9.5.5 will fix this.

>* lhbm will cause a download--if you give lhbm the message-ID of an article
>  not in the header list but on the server, that article will be added to
>  the bottom of the current header list.

  A new intrinsic function has been added to 0.9.5.5 that allows you
  to locate an article by message-id and whether or not to query the
  server.

>define delete_thread_no_move ()
>{
>   if (is_group_mode ())
>     error (_function_name () + " doesn\'t work in group mode!");
>
>   variable
>     starting_article = extract_article_header ("Message-ID"),
>     thread_was_collapsed = is_thread_collapsed ();
>
>   uncollapse_thread ();
>   loop (thread_size ())                         % call("delete_thread")-ish
>     {
>	set_header_flags (get_header_flags () | HEADER_READ);
>	() = header_down (1);                    % just because I'm lazy and
>     }                                           % it's sufficiently terse
>
>   set_input_string (starting_article);          % go back to where we started
>   call ("locate_header_by_msgid");              % lhbm is slightly buggy
>   if (thread_was_collapsed) collapse_thread (); % restore thread collapse
>   else uncollapse_thread ();                    % to work around lhbm bug
>}

Currently, through 0.9.5.4, locate_header_by_msgid guarantees that the
thread will always be uncollapsed.  Hence, you can replace

   if (thread_was_collapsed) collapse_thread ();
   else uncollapse_thread ();

by:

   if (thread_was_collapsed) collapse_thread ();

For 0.9.5.5, you can replace:

   set_input_string (starting_article);          % go back to where we started
   call ("locate_header_by_msgid");              % lhbm is slightly buggy

by:

   () = locate_header_by_msgid (starting_article, 0);

Keep in mind that for 0.9.5.5, locate_header_by_msgid will preserve
the state of the thread as long as the header that you are seeking is
not collapsed. 

I hope to release 0.9.5.5 (mainly a bug-fix release) next weekend.

--John
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