[Top][All Lists]

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

RE: unhelpful menu keybinding notes

From: Drew Adams
Subject: RE: unhelpful menu keybinding notes
Date: Mon, 17 Apr 2006 09:57:05 -0700

    In some parts of Emacs we use another trick: make and use an alias,
    like `advertised-undo'.  I think this is a bad solution because
    C-h f undo RET then lists all bindings except for the "advertised"
    one C-x u.

I agree.

    Maybe a better solution is to add an `advertised-binding' property
    to the function's symbol:

      (put 'undo 'advertised-binding [?\C-x ?u])

    which could be used similarly to the :key-sequence property in menus
    (i.e. it's used if the key seuqnece is indeed bound to the specified

Some other ideas were kicked around previously. I don't recall them, but
it's worth discussing all of them sometime after the release. I like your
idea, but:

- What to do if the key sequence is not bound to the specified command and
there are several bindings? Which to pick?

- It might increase maintenance (but so might other solutions): Changing the
bindings in the library would also mean updating this property.

One question to consider is whether we want to allow control over what gets
communicated 1) at the point of use of `substitute-command-keys' or a doc
string or 2) at some earlier, more general point - or both.

For #2, a library might (somehow, perhaps using more or less the mechanism
you proposed) specify a list of bindings, in preference order, that would
apply to all uses of `substitute-command-keys' and all doc strings.

For #1, we might devise some way to indicate the preferred binding to use at
the point of call. For example (just thinking out loud; not a proposal),
"\\[((kbd "C-x") (kbd <f1> SPC) (kbd "C-M-<down>"))...]" might stipulate
using binding (kbd "C-x") if applicable, else (kbd <f1> SPC) if applicable,
else (kbd "C-M-<down>"). There might also be some way to specify a default
for the case where none were applicable.

Both general presciption (#2) and spec at point of use (#1) could of course
be used together, the latter (#1) taking precedence.

reply via email to

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