🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #43811

Re: SLRN Macros/Hooks

#43811
From: Thorfinn
Date: Thu, 15 Oct 1998 00:00
87 lines
4418 bytes
Dawn Owens-Nicholson wrote:
> Thorfinn wrote:
> > Anyway... Here's what I do in order to get slrn to always display
> > headers and scores in the article list window:
> Actually, you can't guarantee the full header list will always show.
> Another macro could call("toggle_headers") and odd number of times and throw
> off your macro entirely.

Well... that's why I always do it only once.  It's pretty much a hack
workaround, until JED puts in a show_header_hook() or something like
that.

> >    if (done_singleton_show_headers == 0)
> If you really want to do this, however, I suggest using:
>      !if (done_singleton_show_headers)
> it's more S-Langish.

Ahuh.  I tend to stick to my C/C++ish style, since I haven't looked at
much sample slang-code to get a feel of how its style normally is.

> >       variable oldflags = get_header_flags();
> Thanks for saving state and restoring it at the end, I appreciate it.  It's
> nice to know someone besides me is interested in macros that do this.
> However, I don't see what this has to do with showing headers.  You never
> use or modify the flags anywhere in your macro (besides the
> set_header_flags() at the end); neither call("toggle_headers") nor
> call("hide_article") modify the article flags.

Ah.  toggle_headers causes the article to display, and get set to
"read".  I prefer to unset that "read" flag, so that the singleton
causes the headers to display without actually *appearing* to do anything
different.

> >       call("toggle_headers");
> This is the buggy part.  If there were a way to conditionally do this, it
> could be fixed.

Well, yes.  This is why I only do it once, ever, and that's usually the
first time toggle_headers is called... since the only time toggle_headers
can be called is inside article mode... and the hook is called
immediately on entry to article mode...

If toggle_headers gets called *after* this hook runs, it doesn't matter.
It's only *supposed* to be a singleton run, and if the user decides
later that they don't want to see headers any more, fine.

> >       call("hide_article");
> This should be done conditionally since you don't want to toggle
> hiding/unhiding the article:
>         if (is_article_visible ()) call ("hide_article");  % hide the article

Hrm.  That's true.  I should do that.

> >       call("redraw");
> 
> Actually, you don't need to redraw the screen.  Setting display_scores is
> sufficient to show/hide the scores.  But this brings up a larger point--what
> does showing scores have to do with showing headers?

Nothing.  :) It's just another thing I threw in there, and didn't take
out when I posted it.

> > Something like it on a per newsgroup basis is possible, if you, say,
> > keep track of the state of "toggle_headers" [...]
> In general, macros like this aren't a really good idea for wide
> dissemination because when the wrapper functions aren't used consistently,
> they fail when they're used.

Well, yes.  That's why I only posted the singleton, which is pretty safe.
If I posted code that required definekeys to remap stuff, and required
all kinds of calls from different hooks, that would be bad.

So I just described it vaguely, so someone with programming clues would
understand it, and be able to implement it, but people without, wouldn't
try.

Later,

    thorfinn

-- 
<a href="http://www.tertius.net.au/~thorfinn">thorfinn@tertius.net.au</a>
Any sufficiently advanced technology is indistinguishable from a
rigged demo.


Technical Details
Message-ID: <slrn72auif.ma.thorfinn@tertius.net.au>
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
References: <slrn7261p3.1g7.perlman@linguist.dartmouth.edu> <slrn728b1d.ma.thorfinn@tertius.net.au> <slrn72a39n.j19.bluemoon@ux6.cso.uiuc.edu>

Show Full Headers
Complete Article Headers
Message-ID: <slrn72auif.ma.thorfinn@tertius.net.au>
Subject: Re: SLRN Macros/Hooks
Date: Thu, 15 Oct 1998 00:00:00 +0000
From: thorfinn@tertius.net.au (Thorfinn)
References: <slrn7261p3.1g7.perlman@linguist.dartmouth.edu> <slrn728b1d.ma.thorfinn@tertius.net.au> <slrn72a39n.j19.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: 401240061
X-Silly-Line: The moving cursor writes, and having written, blinks on.
X-Newsgroup: news.software.readers
Organization: Unico Computer Systems
User-Agent: slrn/0.9.5.3 (UNIX)
Reply-To: thorfinn@tertius.net.au
Newsgroups: news.software.readers
X-Religion: linux slrn mutt vim