🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #48106

Re: Slrn: marking article/thread read without moving to next unread?

#48106
From: 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>).
Technical Details
Message-ID: <slrn7hl067.idp.bluemoon@ux6.cso.uiuc.edu>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp!not-for-mail
References: <slrn7h3o65.jcd.hezu@tuuri.ling.helsinki.fi> <slrn7h472c.6d.c928400@urdybet.pbk.dk> <slrn7h4883.or7.davis@aluche.mit.edu> <slrn7h62fn.s3k.hezu@tuuri.ling.helsinki.fi> <slrn7h6vl6.103.c928400@urdybet.pbk.dk> <slrn7h8g72.8s3.hezu@tuuri.ling.helsinki.fi> <slrn7hac9a.upb.sas@hpprobe.div111.bell-labs.com> <slrn7hbepo.2nb.c928400@urdybet.pbk.dk> <slrn7hf4jr.a1k.bluemoon@ux6.cso.uiuc.edu> <slrn7hf9ek.ae.c928400@urdybet.pbk.dk> <slrn7hfd9j.51k.bluemoon@ux6.cso.uiuc.edu> <slrn7hglm7.1hh.c928400@urdybet.pbk.dk>

Show Full Headers
Complete Article Headers
Message-ID: <slrn7hl067.idp.bluemoon@ux6.cso.uiuc.edu>
Subject: Re: Slrn: marking article/thread read without moving to next unread?
Date: Mon, 19 Apr 1999 00:00:00 +0000
From: blue...@ux6.cso.uiuc.edu (Dawn Owens-Nicholson)
References: <slrn7h3o65.jcd.hezu@tuuri.ling.helsinki.fi> <slrn7h472c.6d.c928400@urdybet.pbk.dk> <slrn7h4883.or7.davis@aluche.mit.edu> <slrn7h62fn.s3k.hezu@tuuri.ling.helsinki.fi> <slrn7h6vl6.103.c928400@urdybet.pbk.dk> <slrn7h8g72.8s3.hezu@tuuri.ling.helsinki.fi> <slrn7hac9a.upb.sas@hpprobe.div111.bell-labs.com> <slrn7hbepo.2nb.c928400@urdybet.pbk.dk> <slrn7hf4jr.a1k.bluemoon@ux6.cso.uiuc.edu> <slrn7hf9ek.ae.c928400@urdybet.pbk.dk> <slrn7hfd9j.51k.bluemoon@ux6.cso.uiuc.edu> <slrn7hglm7.1hh.c928400@urdybet.pbk.dk>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp!not-for-mail
X-Deja-AN: 468114147
Organization: University of Illinois at Urbana-Champaign
User-Agent: slrn/0.9.5.4 (UNIX)
Newsgroups: news.software.readers,alt.lang.s-lang