Article View: news.software.readers
Article #147316Re: [slrn] macro help please
From: J.B. Nicholson-Owens
Date: Fri, 30 Apr 2004 02:53
Date: Fri, 30 Apr 2004 02:53
52 lines
2941 bytes
2941 bytes
I recommend one of the following. This version works if you are trying to
reset to slrnrc settings:
#v+
implements ("my");
private variable
default_query_next_group = get_variable_value ("query_next_group"),
default_confirm_actions = get_variable_value ("confirm_actions");
static define quit_group ()
{
set_integer_variable ("query_next_group", 0);
set_integer_variable ("confirm_actions", 0);
call ("catchup_all");
call ("next");
set_integer_variable ("query_next_group", default_query_next_group);
set_integer_variable ("confirm_actions", default_confirm_actions);
}
#v-
I recommend the following if you are trying to reset to the current settings
at the moment the function is called:
#v+
implements ("my");
static define quit_group ()
{
variable
query_next_group = get_variable_value ("query_next_group"),
confirm_actions = get_variable_value ("confirm_actions");
set_integer_variable ("query_next_group", 0);
set_integer_variable ("confirm_actions", 0);
call ("catchup_all");
call ("next");
set_integer_variable ("query_next_group", query_next_group);
set_integer_variable ("confirm_actions", confirm_actions);
}
#v-
> I should probably test the contents of query_next_group and not set it to
> 0 if is already 0 and not set it back to 1. Ditto for confirm_actions
> since all I really want to do is decrease it by 1 and then restore it. Any
> shortcuts on doing that??
I wouldn't look for a shortcut nor would I bother with a test because in my
experience these things make code unclear and, in the long run, aren't a
good tradeoff against stating what you want to happen. For code like this,
I tend to favor code I'll understand at a glance in 6 months over clever
code.
Technical Details
Message-ID:
<slrnc93fsp.5do.jbn@forestfield.org>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.20140922.mbox.gz!number1.nntp.ash.giganews.com!internal1.nntp.sjc.giganews.com!border2.nntp.sjc.giganews.com!border1.nntp.sjc.giganews.com!nntp.giganews.com!newsfeed.news2me.com!newsfeed.icl.net!feed.news.tiscali.de!fu-berlin.de!uni-berlin.de!12-221-67-248.client.insightbb.COM!not-for-mailReferences:
<rc32m1-4mc.ln1@news.invalid.99computer> <slrnc8t01h.6s8.jbn@forestfield.org> <mq06m1-s4q.ln1@news.invalid.99computer>Show Full Headers
Complete Article Headers
Message-ID: <slrnc93fsp.5do.jbn@forestfield.org> Subject: Re: [slrn] macro help please Date: Fri, 30 Apr 2004 02:53:15 +0000 From: "J.B. Nicholson-Owens" <jbn@forestfield.org> References: <rc32m1-4mc.ln1@news.invalid.99computer> <slrnc8t01h.6s8.jbn@forestfield.org> <mq06m1-s4q.ln1@news.invalid.99computer> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.20140922.mbox.gz!number1.nntp.ash.giganews.com!internal1.nntp.sjc.giganews.com!border2.nntp.sjc.giganews.com!border1.nntp.sjc.giganews.com!nntp.giganews.com!newsfeed.news2me.com!newsfeed.icl.net!feed.news.tiscali.de!fu-berlin.de!uni-berlin.de!12-221-67-248.client.insightbb.COM!not-for-mail Newsgroups: news.software.readers Organization: Forest Field OmniMedia Lines: 52 NNTP-Posting-Host: 12-221-67-248.client.insightbb.com (12.221.67.248) X-Trace: news.uni-berlin.de 1083293595 16427334 I 12.221.67.248 ([35848]) Mail-Copies-To: nobody User-Agent: slrn/0.9.7.4 (Linux)