Article View: news.software.readers
Article #35996Re: Slrn wish
From: Byrial Jensen
Date: Sat, 06 Sep 1997 00:00
Date: Sat, 06 Sep 1997 00:00
76 lines
3037 bytes
3037 bytes
Ian T Zimmerman <itz@rahul.net> wrote:
> there's currently no way to _query_ the current
>prefix argument, as entered interactively by the user.
Here it is. The following patch defines 2 functions which can be called
from Slang macros:
- "get_prefix_arg" returns the prefix argument, or -1 if none is set.
- "reset_prefix_arg" removes the current prefix argument, so it won't
be used by other functions called by the macro.
define test_function ()
{
variable prefix_arg;
variable msg;
prefix_arg = get_prefix_arg;
reset_prefix_arg;
if (prefix_arg == -1)
msg = "No prefix argument set";
else
msg = Sprintf ("The prefix argument is: %d", prefix_arg, 1);
message (msg);
}
definekey ("test_function", "T", "group");
definekey ("test_function", "T", "article");
Best regards
- Byrial
--- interp.c.org Sat Sep 6 10:15:57 1997
+++ interp.c Sat Sep 6 10:48:26 1997
@@ -520,6 +520,22 @@
/*}}}*/
+int get_prefix_arg (void) /*{{{*/
+{
+#define NO_PREFIX_ARGUMENT -1
+
+ return Slrn_Prefix_Arg_Ptr ? *Slrn_Prefix_Arg_Ptr : NO_PREFIX_ARGUMENT;
+}
+
+/*}}}*/
+
+void reset_prefix_arg (void) /*{{{*/
+{
+ Slrn_Prefix_Arg_Ptr = NULL;
+}
+
+/*}}}*/
+
static int check_tty (void)
{
if (Slrn_TT_Initialized & SLRN_TTY_INIT)
@@ -1040,6 +1056,7 @@
MAKE_INTRINSIC(".get_header_score", get_header_score, INT_TYPE, 0),
MAKE_INTRINSIC(".get_header_tag_number", get_header_tag_number, INT_TYPE, 0),
MAKE_INTRINSIC(".get_next_art_pgdn_action", slrn_get_next_pagedn_action, INT_TYPE, 0),
+ MAKE_INTRINSIC(".get_prefix_arg", get_prefix_arg, INT_TYPE, 0),
MAKE_INTRINSIC(".get_response", get_response, INT_TYPE, 0),
MAKE_INTRINSIC(".get_select_box_response", interp_select_box, INT_TYPE, 0),
MAKE_INTRINSIC(".get_variable_value", get_variable_value, VOID_TYPE, 0),
@@ -1070,6 +1087,7 @@
MAKE_INTRINSIC(".re_search_article", re_search_article, INT_TYPE, 1),
MAKE_INTRINSIC(".read_mini", read_mini, VOID_TYPE, 0),
MAKE_INTRINSIC(".read_mini_no_echo", read_mini_no_echo, VOID_TYPE, 0),
+ MAKE_INTRINSIC(".reset_prefix_arg", reset_prefix_arg, VOID_TYPE, 0),
MAKE_INTRINSIC(".save_current_article", save_current_article, INT_TYPE, 1),
MAKE_INTRINSIC(".search_article", search_article, INT_TYPE, 1),
MAKE_INTRINSIC(".select_group", select_group, INT_TYPE, 0),
Technical Details
Message-ID:
<slrn612906.1dp.byrial@ask.ask>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-mailReferences:
<slrn60u4cu.mvh.itz@kronstadt.rahul.net>Show Full Headers
Complete Article Headers
Message-ID: <slrn612906.1dp.byrial@ask.ask> Subject: Re: Slrn wish Date: Sat, 06 Sep 1997 00:00:00 +0000 From: byrial@post3.tele.dk (Byrial Jensen) References: <slrn60u4cu.mvh.itz@kronstadt.rahul.net> 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: 270201997 X-Complaints-To: abuse@news.inet.tele.dk X-Trace: news.inet.tele.dk 873538646 427622 (None) 194.239.129.45 Newsgroups: news.software.readers