emacs-devel
[Top][All Lists]
Advanced

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

Re: Get a command by its keybinding and also respecting keytranslation


From: Tassilo Horn
Subject: Re: Get a command by its keybinding and also respecting keytranslation
Date: Wed, 15 Dec 2010 23:17:54 +0100
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/24.0.50 (gnu/linux)

"Drew Adams" <address@hidden> writes:

Hi Drew,

> What is the advantage of having multiple bindings for the same key (in
> the same map) and picking which is used according to a condition?  Why
> not just bind the key to a command that tests those same conditions?

Basically, it's pretty much equivalent, except that the key binding
approach seems a bit more general in that the original command that
would normally have been triggered by KEY is executed automatically if
no predicate matches.  With a DWIM wrapper command, you have to look
that up first and put it in the command as fallback.  And you'd probably
have to manually set this-command/last-command in order to keep the
wrapper out but only the "real" commands which you have to call
interactively...

Another really cool feature with Stefan's approach is that `C-h k' in
some special context matched by one of the predicates will show the docs
of the command in that context.  With a wrapper, you have to write your
own docstring explaining all possible contexts and actions.

Bye,
Tassilo



reply via email to

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