Re: Binding multiple actions to a single keystroke

Christian Ebert <[email protected]> Wed, 14 Jul 2010 11:36:55 +0200
Newsgroups gmane.network.slrn.user
Organization Black Trash Productions http://www.blacktrash.org/
Message-ID <[email protected]>
* Benjamin Esham on Tuesday, July 13, 2010 at 21:38:31 -0400
> I'm a slrn newbie, having used it for just a week or so, and I have a dumb
> question about custom key shortcuts.  In article mode, I'd like to bind
> "<Esc>c" to "catch up and leave this group", i.e. the action that would
> result from the key sequence "cyq".  (I specifically do not want to have to
> confirm the 'c' action.)  I'm finding that I don't really understand how to
> program slrn to do these kinds of things... I guess I'd need to have a line
> something like
> 
>    setkey article catch_up_and_leave "\ec"
> 
> to my .slrnrc, but I'm not quite sure how to specify the function
> catch_up_and_leave.  Can anyone help me out with that, or point toward an
> easier way to accomplish what I want?

Use an S-Lang macro (untested):

#v+
implements ("CatchupLeave");

static define catch_up_and_leave {
  % store current value of confirm_actions variable
  confirm_actions = get_variable_value ("confirm_actions");
  set_integer_variable ("confirm_actions", 0);
  call ("catchup");
  call ("quit");
  set_integer_variable("confirm_actions", confirm_actions);
}

definekey ("CatchupLeave->catch_up_and_leave", "\ec", "article");
#v-

I'm too lazy now to describe how to source the macro, I'm sure
you'll find out ;-)

c
-- 
theatre - books - texts - movies
Black Trash Productions at home: http://www.blacktrash.org/
Black Trash Productions on Facebook:
http://www.facebook.com/blacktrashproductions

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first