🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.readers
2 messages
2 total messages Started by Clint Olsen Wed, 27 Aug 1997 00:00
Re: Wish List for SLRN
#35905
Author: Clint Olsen
Date: Wed, 27 Aug 1997 00:00
24 lines
1359 bytes
I tried this in my .slrn.sl file:

% Function definitions

define article_pagedn ()
{
  if (is_article_visible ())
    call ("scroll_dn");
  else  call ("pagedn");
}

definekey ("article_pagedn", " ", "article");     % use nifty slang function

I want the space bar to go to the next page of articles (kind of like trn)
when no article is showing, but I cannot seem to get it to work.  Any ideas
what I might be doing wrong?  I tried to use a binding to something that
wasn't being used by setkey since I wasn't sure what would happen if you
attempted to overload a setkey with a definekey.  I also found it rather
annoying that you can't put slang code in your .slrnrc.

-Clint

Re: Wish List for SLRN
#35915
Author: Jan Hlavacek
Date: Thu, 28 Aug 1997 00:00
93 lines
3623 bytes
On 27 Aug 1997 17:36:26 GMT, Clint Olsen <olsenc@kodiak.ee.washington.edu>
wrote:
> I tried this in my .slrn.sl file:
> 
> % Function definitions
> 
> define article_pagedn ()
> {
>   if (is_article_visible ())
>     call ("scroll_dn");
>   else  call ("pagedn");
> }
> 
> definekey ("article_pagedn", " ", "article");     % use nifty slang function
> 

article_pagedn is an internal function.  When executing a key,  slang first
looks for internal function,  then for an interpreter function.  So if there
is an internal function with the given name,  your function never gets
executed.  So all you have to do is to change the name of your function.

BTW,  a list of slrn internal functions is at 

http://www.math.ohio-state.edu/~lahvak/software/slrn/internals.html

> I want the space bar to go to the next page of articles (kind of like trn)
> when no article is showing, but I cannot seem to get it to work.  Any ideas
> what I might be doing wrong?  I tried to use a binding to something that
> wasn't being used by setkey since I wasn't sure what would happen if you
> attempted to overload a setkey with a definekey.  I also found it rather

Apply included patch to startup.c.  It will allow you to put little pieces of
slang code into your .slrnrc.  You can put the following to your .slrnrc:

eval "define my_useless_function () {message (\"useless function executed\")}"

setkey article my_useless_function "M"

--- startup.c.old	Thu Aug 28 04:49:48 1997
+++ startup.c	Thu Aug 28 05:19:46 1997
@@ -60,6 +60,7 @@
 static int grouplens_fun (int, SLcmd_Cmd_Table_Type *);
 static int interpret_fun (int, SLcmd_Cmd_Table_Type *);
 static int include_file_fun (int, SLcmd_Cmd_Table_Type *);
+static int eval_slang_fun (int, SLcmd_Cmd_Table_Type *);
 
 /*}}}*/
 /*{{{ Static Global Variables */
@@ -89,6 +90,7 @@
      {interpret_fun, "interpret", "S"},
      {include_file_fun, "include", "S"},
      {user_data_fun, "scorefile", "S"},
+     {eval_slang_fun, "eval", "S"},
    
    /* The following are considered obsolete */
      {user_data_fun, "username", "S"},
@@ -1154,6 +1156,27 @@
    (void) argc;
    return 0;
 #endif
+}
+
+/*}}}*/
+
+static int eval_slang_fun (int argc, SLcmd_Cmd_Table_Type *table) /*{{{*/
+{
+#if SLRN_HAS_SLANG
+   char *slang = table->string_args [1];
+   
+   (void) argc;
+   if (Slrn_Use_Slang == 0) return 0;
+   SLang_load_string (slang);
+   if (SLang_Error) 
+     {
+        SLang_Error = 0;
+        return -1;
+     }
+#else
+   (void) argc;
+#endif
+   return 0;
 }
 
 /*}}}*/

-- 
Jan Hlav\'{a}\v{c}ek <lahvak+n@math.ohio-state.edu>  (BCC's will bounce)
home page: http://www.math.ohio-state.edu/~lahvak/
slrn page: http://www.math.ohio-state.edu/~lahvak/software/slrn.html
slrn documentation: http://www.math.ohio-state.edu/~lahvak/software/slrn/

Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads