On Fri, Sep 14, 2012 at 09:32:01AM +1000, Cameron Simpson wrote:
> On 12Sep2012 19:37, Lewis Pike <phaseloc...@gmail.com> wrote:
> > Is it possible to bind multiple functions to a single key such
> > that successive keypresses cycle through the functions?  I'd like
> > to be able to use the control-l key to first execute
> > <current-middle>, then if it is pressed again, to execute
> > <current-top> and finally, if pressed a third time, execute
> > <current-bottom>.
> > 
> > For emacs users, the functionality I'm looking for would be
> > similar to the Control-l key in emacs which executes the
> > recenter-top-bottom command.
> 
> You could bind it to a macro that performas the current operation
> and then rebinds it to the next one. I'd put each macro in a file
> and have the macro source the next file in the cycle.
> 
> Untested suggestion:
> 
> In mail muttrc:
> 
>   source ~/.mutt-ctrl-L-1
> 
> In ~/.mutt-ctrl-L-1:
> 
>   macro index \CL '<current-middle>:source ~/.mutt-ctrl-L-2<enter>'
> 
> and so forth in .mutt-ctrl-L-2 and 3.

What a clever solution.  I had not thought of this approach.  I just
tested it and it works as expected.  The behavior of the control-l key
is now nearly identical to the emacs recenter-top-bottom function to
which I have become so accustomed.

-- Lewis

Reply via email to