Re: Query next article - feature suggestion
"J.B. Nicholson-Owens" <[email protected]>
| Newsgroups | gmane.network.slrn.user |
|---|---|
| Message-ID | <[email protected]> |
Andrew wrote about the query_next_article variable: > I set this variable to 0 (no confirmation before reading the next > article), but I think it could be useful if there were a third possible > state, where slrn will ask for confirmation *only* if the present > article is displayed in full. This could be done with a macro, if I understand what you're asking for. Use the attached macro file (called "my_macros.sl") by copying it into your home directory in the .slrn directory, then add the following line to your ~/.slrnrc: interpret ~/.slrn/my_macros.sl This will load the macro file when you next run slrn. This macro file defines a function which will run when you hit the spacebar (the default keybinding for the article_page_down intrinsic function. If you set the query_next_article variable to whatever you prefer for articles too long to read all at once, this function will reset that variable to 1 when you press spacebar on an article you're reading in its entirety. The query_next_article setting you chose will be reset before this macro stops running, so your other macros and preferences should not be disturbed by using this macro. The name of the function matters, so unless you are willing to change 2 lines of code, don't alter the name of the function. I named it this way so that others can see what I'm aiming to build upon. I haven't tested this because it's somewhat inconvenient for me to do at this moment, but if you'd care to share whatever error you get I'll try to fix the error. There might be an off-by-one or off-by-two error because I'm using a slightly cheesy way to determine if you're seeing the entire article. 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
my_macros.sl
(text/plain, 1.4 KB)
implements ("my");
static define article_page_down () {
% Builds upon the article_page_down intrinsic function by turning query
% mode on (1) for articles that are seen in their entirety.
% This doesn't work in group mode. A small bit of error checking here.
% If you remove this check, don't bind this function to any key in
% group mode.
if (is_group_mode ()) { return; }
% Are we looking at the article pointed to by the cursor? 3 is
% a bitmapped value indicating that the article is visible and the
% article being pointed to by the cursor.
if (_is_article_visible () != 3) { return; }
% What will happen if we ask for the next page of this article?
% We only care if the user will see the next unread article (1).
if (1 != get_next_art_pgdn_action ()) { return call (_function_name ()); }
% We've weeded out the other cases, time to deal with the interesting
% case: figuring out if this page is the one and only page of the
% article (are we seeing the entire article?).
if (article_count_lines () > get_article_window_size ()) { return call (_function_name ()); }
% Answer to above question: Yes, we are.
variable query_next_article_default = get_variable_value ("query_next_article");
set_integer_variable ("query_next_article", 1);
call (_function_name ());
set_integer_variable ("query_next_article", query_next_article_default);
}
definekey ("my->article_page_down", " ", "article");