help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Short-circuiting keybindings?


From: Elena
Subject: Re: Short-circuiting keybindings?
Date: Wed, 08 Dec 2010 15:35:19 -0000
User-agent: G2/1.0

On 10 Nov, 00:08, p...@informatimago.com (Pascal J. Bourguignon)
wrote:
> Elena <egarr...@gmail.com> writes:
> > is there a generic way to create "short-circuiting" keybindings?  I
> > mean: let's say I want "C-b" to issue a command only whenever a
> > condition is met, otherwise if "C-b" is a prefix key then Emacs should
> > continue listening for keystrokes and execute commands when
> > appropriate.
>
> Really, to do what you have in mind, the easiest and cleanest would be
> to modify the core of emacs, in the C sources.

Ouch!  That would be cumbersome.

> > You could add hooks, or change the mechanisms.

Thanks for your suggestion.  Such goal can be achieved on case basis.
For instance, let's say we want "C-b" to be bound to a command, thus
shadowing "C-b C-c", only when region is active.  We could bind "C-b C-
b" globally, while binding "C-b" in `activate-mark-hook' and unbinding
it in `deactivate-mark-hook'.  Right?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]