emacs-devel
[Top][All Lists]
Advanced

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

Consistent face for keys in *Help* and `substitute-command-keys'


From: Stefan Kangas
Subject: Consistent face for keys in *Help* and `substitute-command-keys'
Date: Tue, 23 Feb 2021 19:40:07 -0600

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Stefan Kangas <stefan@marxist.se> writes:
>
>> One of the usability complaints I've heard is that `help-for-help'
>> (`C-h C-h') could be better organized.  I also think some colors could
>> really help in making it easier to navigate.
>
[...]
>
> Is using font locking the best option here, though?  What about just
> inserting the text with the text properties already applied?

OK, so here's what I came up with so far.

The first step was to insert the keybindings with the new face.  But
rather than doing that in just `help-for-help', and perhaps improve
other things later, I realized that it is better to decide on a
consistent look for keybindings in _all_ help commands.

This means introducing a new face `help-key-binding' and then using that
any time we output a keybinding for use in the help system.

But going even further than that, I realized it would be very useful if
this face applies to any key in any message we output, by convention.
This would be a useful improvement in consistency, in the same way it
helps to consistently use `C-' to mean the Control modifier.  It makes
it easier for users to see that, hey, this text is different in the same
way that other keybindings have been, so it must also be referring to a
keybinding.

So I have made `substitute-command-keys' add this face unconditionally
to keys.

Having looked over the 430 matches for s-c-k in our tree, I couldn't
find any location where we would not benefit from this consistency.  On
the contrary, it would be quite nice to see that the same face used in
*Help* also shows up in messages such as these:

    "Use \\[shadow-copy-files] to update shadows."
    "Press \\[wdired-finish-edit] when finished or \\[wdired-abort-changes] ..."
    "\\[scroll-up] scrolls up, \\[scroll-down] scrolls down, ..."

Please find attached a patch.  It is a little bit rough around the edges
still so needs polishing up and documentation.  For testing, try e.g.
`C-h C-h', `C-h C-h', `C-h C-c', or even `C-s C-h ?'.

Thoughts welcome.

Attachment: 0001-Colorize-keybindings-in-help.patch
Description: Text Data


reply via email to

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