🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.readers
6 messages
6 total messages Started by Arjan Drieman Sun, 23 Jul 2000 00:00
[slrn] Binding esc 1 control-i
#63597
Author: Arjan Drieman
Date: Sun, 23 Jul 2000 00:00
28 lines
1645 bytes
Hello,

I wrote a vewwy pretty script and bound it to esc crontrol-i using
       definekey ("cancels", "\e^i", "article");

I'm extending the script now and would like to use esc 1 control-i for
some function.  So with my dumb logic I thought that maybe

       definekey ("cancel_file", "\e1^i", "article");

would do the trick.  Apparently, it doesn't work that way:
       S-Lang Error: Inconsistency in define key.

So how can I bind esc 1 control-i?  I'm using slrn om linux/i386, in
case that matters.


Oh, another question comes to mind:  How can I override the default
function for esc crontrol-c?  I've tried it using
       undefinekey ("\e^c", "article");
       definekey ("cancels", "\e^c", "article");
but it still uses slrn's internal cancel function.


Thanks in advance,
Arjan

Re: [slrn] Binding esc 1 control-i
#63642
Author: Arjan Drieman
Date: Sun, 23 Jul 2000 00:00
27 lines
1711 bytes
On 23 Jul 2000 19:05:36 GMT, J.B. Nicholson-Owens
    <jbn@forestfield.org> wrote:

>#v+
>  public define my_function ()
>  {
>     message_now ("This is a test.");
>  }
>  definekey ("Global->my_function", "\e^C", "article");
>  definekey ("Global->my_function", "\e^C", "group");
>#v-
>
>and it worked as I expected--only Global->my_function() was executed.

Could you please tell me where you've learned the use of the "public"
("static", etc) keywords as well as the function references like
Global-> ?  Having a c++ oop background I have some idea what it all
means, but I don't know the exact meaning and use in S-Lang.

I haven't seen it in any S-Lang documentation yet.  Perhaps I'm not
reading the right documents ;-)


Thanks a lot for your help,
Arjan

Re: [slrn] Binding esc 1 control-i
#63646
Author: J.B. Nicholson-Owens
Date: Sun, 23 Jul 2000 00:00
33 lines
1444 bytes
Arjan Drieman wrote:
> So how can I bind esc 1 control-i?

Make your program parse the prefix argument with get_prefix_arg() and use
the definekey() or setkey statement without the prefix argument:

#v+
  definekey ("cancels", "^I", "article");     % in S-Lang code
#v-

or

#v+
  setkey article cancels ^I                   % in your slrnrc
#v-

> Oh, another question comes to mind:  How can I override the default
> function for esc crontrol-c?

I tried this:

#v+
  public define my_function ()
  {
     message_now ("This is a test.");
  }
  definekey ("Global->my_function", "\e^C", "article");
  definekey ("Global->my_function", "\e^C", "group");
#v-

and it worked as I expected--only Global->my_function() was executed.

[S-Lang] Documentation on namespaces?
#63661
Author: j... J.B. Nicholson-Owens
Date: Mon, 24 Jul 2000 00:00
13 lines
1279 bytes
[Since we're talking about S-Lang, I'm crossposting to the S-Lang group. I'd
 set followups there too but too many people don't get non-big-8 groups like
 alt.lang.s-lang.]

Arjan Drieman wrote:
> Could you please tell me where you've learned the use of the "public"
> ("static", etc) keywords as well as the function references like
> Global-> ?

In your S-Lang distribution, check out the S-Lang tutorial doc/slang.txt.
S-Lang's namespaces are described there as is the rest of the language.
Re: [slrn] Binding esc 1 control-i
#63710
Author: Arjan Drieman
Date: Mon, 24 Jul 2000 00:00
107 lines
4016 bytes
[Also X-posted to alt.lang.s-lang, but no followup set.  It depends on
the answer whether it's a slang or slrn issue ;-)  I'll read both
groups, please place followups where you think is appropriate.  Thanks.]

On 23 Jul 2000 19:05:36 GMT, J.B. Nicholson-Owens
    <j...@forestfield.org> wrote:

[I downloaded the source for slang and found the documentation.  I'll
file a bug to debian later for not including it ;-)  Thanks.]

>#v+
>  public define my_function ()
>  {
>     message_now ("This is a test.");
>  }
>  definekey ("Global->my_function", "\e^C", "article");
>  definekey ("Global->my_function", "\e^C", "group");
>#v-
>
>and it worked as I expected--only Global->my_function() was executed.

This is driving me batty, nuts, insane, everything %-)

I've got this now:

#v+
% prototyping
public define main();
public define main_prefix();
define edit_mid_file();
% [...]

undefinekey ("\e^C", "article");
definekey ("Global->main", "\e^C", "article");
definekey ("Global->main_prefix", "^C", "article");
definekey ("Global->main_prefix", "^C", "group");

% Comes in handy while hackin'
define load_script () {
        () = evalfile ("/home/duckie/News/slang/cancels.sl");
        message("Cancelscript Reloaded.");
}
define edit_mid_file () {
        message("edit_mid_file");
}

public define main_prefix () {
        switch (get_prefix_arg ())
        {case 0 : load_script();}
        {case 1 : edit_mid_file();}
        {verror ("Operation not supported");}
}

public define main () {
% [...]
}
#v-

Okay and now the weird part.  When I fire up slrn, hit esc control-c, I
/still/ get the internal cancel function.

*Until* I reload the script using esc 0 control-c, then esc control-c
gives me my main().  This does *not* happen when I use esc 1 control-c,
for example, only after reloading it.  So the esc <N> control-c
functions work fine, but esc control-c doesn't, until I reload the file
with evalfile().

I've also tried omitting the prototyping and putting the definekeys at
the bottom of my script,  I've tried to use something like

#v+
implements ("cancels");
static main() {                                 % [...]
definekey ("cancels->main", "\e^C", "article");
#v-

Which should work the same way if I understood the namespaces part
correctly.  Same flaky results, so at least that part's okay ;-)


Omitting the binding for "\e^C" and using a
#v+
public define main_prefix () {
        switch (get_prefix_arg ())
        {case -1 : main();}
% [...]
#v-
also doesn't work, not after reloading through esc 0 control-c either.


What in the world am I doing wrong?  Is there another way to load
slang scripts from .slrnrc than
	interpret "News/slang/cancels.sl"
or something?  Or am I doing something completely stupid here?


I've just tried this with ^I instead of ^C, and then esc control-i
is executed just fine, while esc <N> control-i scrolls the article
window, which is the default behavior...

I'm afraid I won't sleep this week ;-)


Thanks,
Arjan
Re: [slrn] Binding esc 1 control-i
#63723
Author: Arjan Drieman
Date: Mon, 24 Jul 2000 00:00
16 lines
1379 bytes
On 24 Jul 2000 02:41:47 GMT, Arjan Drieman
    <qhpxvr@abqr0911.n2000.ay.invalid> wrote:

[Binding trouble]
>This is driving me batty, nuts, insane, everything %-)

Okay you may smack me senseless, J.B.  I forgot to comment out the
default keybindings in my .slrnrc... Guess things aren't as clear
anymore at 5 am with no caffeine left ;-)

Problem solved... thanks for your help.


Arjan
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