unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Emacs-Devel <emacs-devel@gnu.org>
Subject: Re: Qs on key-description, substitute-command-keys
Date: Sat, 15 Oct 2005 07:54:14 -0400	[thread overview]
Message-ID: <878xwvuhwu.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <DNEMKBNJBGPAOPIJOOICGEGICNAA.drew.adams@oracle.com> (Drew Adams's message of "Fri, 14 Oct 2005 15:53:00 -0700")

> 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

  parent reply	other threads:[~2005-10-15 11:54 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-04 23:55 Qs on key-description, substitute-command-keys Drew Adams
2005-10-05 16:23 ` Kevin Rodgers
2005-10-05 16:39   ` Drew Adams
2005-10-14 22:53 ` Drew Adams
2005-10-15 11:27   ` Juri Linkov
2005-10-15 14:25     ` Drew Adams
2005-10-16 14:40     ` Richard M. Stallman
2005-10-15 11:54   ` Stefan Monnier [this message]
2005-10-15 14:35     ` Drew Adams
2005-10-16 13:07       ` Stefan Monnier
2005-10-16 14:40       ` Richard M. Stallman
2005-10-15 18:00     ` John S. Yates, Jr.
2005-10-16 13:12       ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878xwvuhwu.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).