Re: Binding multiple actions to a single keystroke

Benjamin Esham <[email protected]> Thu, 15 Jul 2010 12:40:58 -0400
Newsgroups gmane.network.slrn.user
Message-ID <[email protected]>
Christian Ebert wrote:

> * Benjamin Esham on Tuesday, July 13, 2010 at 21:38:31 -0400
> 
> > 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.)
> 
> 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-

Hi Christian,

Thanks for the help!  I ended up tweaking your code as follows:

#v+
implements("CatchupLeave");

static define catch_up_and_leave() {
    variable confirm_actions = get_variable_value("confirm_actions");
    set_integer_variable("confirm_actions", 0);
    call("catchup_all");
    call("quit");
    set_integer_variable("confirm_actions", confirm_actions);
}

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

This now works beautifully.  Cheers!
-- 
Benjamin D. Esham   |   [email protected]
“Don’t you think about anyone but yourself?!”
“Of course I do... I just think about myself first.”
                              — Ishka and Quark, Deep Space Nine


------------------------------------------------------------------------------
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