GNU bug report logs - #50804
Command substitutions for keys without keymaps

Previous Next

Package: emacs;

Reported by: Stefan Kangas <stefan <at> marxist.se>

Date: Sat, 25 Sep 2021 18:02:01 UTC

Severity: wishlist

Tags: patch

Fixed in version 29.1

Done: Stefan Kangas <stefan <at> marxist.se>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefan Kangas <stefan <at> marxist.se>
To: 50804 <at> debbugs.gnu.org
Subject: bug#50804: Command substitutions for keys without keymaps
Date: Sat, 25 Sep 2021 11:01:38 -0700
Severity: wishlist

We have "\\[foo]" command substitutions in `substitute-command-keys'.
This also puts the face help-key-binding on the replaced text, which
makes key bindings stand out more clearly.

We don't always have a keymap to refer to, because the keys are read
through `read-key' or similar.

For example, in ispell.el:

    (message (concat "C-h or ? for more options; SPC to leave "
                     "unchanged, Character to replace word")))

In other cases, we have the same situation in a docstring, for example
in `isearch-lax-whitespace'.

It would be nice if we could have some way of putting a face on such key
bindings, without having to fiddle with propertize.  For example:

    (message (substitute-command-keys
              (concat "\\[[C-h]] or \\[[?]] for more options;
\\[[SPC]] to leave "
                      "unchanged, Character to replace word"))))

I'm not sure about the notation.  Perhaps "\\[[...]]" is okay, or
perhaps we want some other delimiter.

And perhaps we would want support for this notation also in
`format-messages'?  I'm not sure, but I'm putting it out there.




This bug report was last modified 3 years and 242 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.