Commentary on Query next article improvement and idea for next slrn macro
"J.B. Nicholson-Owens" <[email protected]>
| Newsgroups | gmane.network.slrn.user |
|---|---|
| Message-ID | <[email protected]> |
Andrew wrote:
> I've tried to make a couple of small changes to your excellent macro.
> Since I don't know SLANG, I hope I didn't mess too many things up.
I'm sure that you didn't, I'll post my two cents on the matter below. If it's
working for you, you did a fine job.
> 9c9
> < if (is_group_mode ()) { return; }
> ---
>> if (is_group_mode ()) { return call (select_group()); }
Instead of this, I'd suggest binding select_group to the spacebar in group
mode directly in your slrnrc (I think it's the default in slrn, so you
shouldn't need to do anything in your slrnrc unless you've redefined the
spacebar to do something else in group mode).
There's a speed penalty for executing any S-Lang macro in slrn. Therefore
it's probably going to feel faster on slow machines to avoid running a macro
when you don't have to. But if you decide that you want to keep this part of
the patch, you'll want to update the comment text to reflect the change.
> 14c14
> < if (_is_article_visible () != 3) { return; }
> ---
>> if (_is_article_visible () != 3) { return call ("article_bob"); }
If this is using a side effect of article_bob -- article_bob will unhide the
current article if it's hidden -- then I suggest not doing this in this way.
Generally speaking, in programming it's not a good idea to rely on
side-effects. When things change, programs that rely on side-effects break
and they break in mysterious and hard-to-debug ways. You'd be better off
doing the unhiding yourself and then showing the first page out of a sense of
clarity of code, if nothing else. I'd suggest:
% Unhide the article and show the first page.
if (_is_article_visible () & 1) { call ("hide_article"); }
call ("article_bob");
instead.
But it looks like you're well on your way to writing some interesting S-Lang
macros for slrn!
Now on to something else: what to do now that you've gotten your feet wet.
Might I suggest trying your hand with interesting methods of displaying
articles by using replace_article(). Perhaps something that keeps some
headers on the top lines of the article display when the article is unhidden,
and scrolls only the article body. The article body would then scroll
independently of the headers. This might not be terribly useful, but it could
look neat.
You'd need to provide rewrites of all the article body scrolling functions so
users could still scroll up/down by a page or a line. Extra cool points for
providing new versions of article_goto_line() and article_count_lines() so
macros could be trivially rewritten to work with your enhancement (a real
drop-in replacement).
One could do this by rewriting what's in the article view so that the
interesting headers are always the top N lines of the rewritten article
string. The remaining lines of the article are below the header lines and a
blank line (so you get header coloring for free). You'll probably also want a
resize_hook() for when the user resizes slrn's display so you can call
article_bob and make sure the "correct" lines of the article are being shown
(since your top of the article is actually some ways into the article, this
should be good enough).
Happy newsreading.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV