[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Qs on key-description, substitute-command-keys
From: |
Stefan Monnier |
Subject: |
Re: Qs on key-description, substitute-command-keys |
Date: |
Sat, 15 Oct 2005 07:54:14 -0400 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
> Does anyone know how to control which of several bindings for a command is
> displayed by `substitute-command-keys'?
There is no way to get this kind of control. `substitute-command-keys' has
some rules such as "prefer a binding using plain ascii keys" (so it'll
prefer C-x < over C-next, based on the principle that not all terminals have
a `next' key and even fewer have a way to generate a C-next event) and
"prefer a shorter binding".
In Emacs, what we do usually when we need to control which binding to show,
is to define `advertized-foo' as an alias for `foo' and then bind the key we
want shown to `advertized-foo' (and then use \\[advertized-foo] in the
string). I find this to be a bad solution: it interacts very poorly with
things like `remap' or `substitute-key-definition' and C-h f `foo' forgets
to show the main advertized binding (bummer!).
I think we should devise some way to get the desired result without going
through contorsions like `advertized-bla'. I haven't thought very deep
about how to do that, but the first thing that jumps to my mind is to rely
on a `preferred-binding' property (containing a key-sequence) on the command
symbol, or otherwise require the use of a menu-item for the main binding and
then obey a boolean ":preferred-binding" property placed on the menu-item.
Stefan