emacs-devel
[Top][All Lists]
Advanced

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

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


From: Stefan Kangas
Subject: Re: Consistent face for keys in *Help* and `substitute-command-keys'
Date: Sun, 7 Mar 2021 02:26:27 -0500

Eli Zaretskii <eliz@gnu.org> writes:

>> It's just to make them alphabetical.
>
> That's what I thought, but then "q" is out of order, isn't it?

Sure.  I left it as it seemed to have been intentionally placed at the
end -- the quit command is "special".  But I don't have any strong
preferences here, so please let me know if you want something changed.

> I'm not sure it's a good idea.  "M-x foobar" is not a key sequence in
> the sense we use it for this feature, I think.  This feature is not
> about displaying any key sequence in any context, it's about
> displaying them in the context of help-related text.

My thinking here is that the face should separate "anything that the
user could type to run a command" from the surrounding body text.  In
this sense, there is no strong difference between an unbound command and
an actual keybinding.  It just seems more helpful.

I don't see any obvious problems with this approach, but perhaps there
is something that I'm overlooking.

BTW, there was a bug in the above code where only the "M-x" part was
fontified, now fixed:

modified   lisp/help.el
@@ -1056,11 +1056,12 @@ substitute-command-keys
                                 (where-is-internal fun keymap t))))
                   (if (not key)
                       ;; Function is not on any key.
-                      (progn
-                        (insert (propertize "M-x "
-                                            'face 'help-key-binding
-                                            'font-lock-face 'help-key-binding))
+                      (let ((op (point)))
+                        (insert "M-x ")
                         (goto-char (+ end-point 3))
+                        (add-text-properties op (point)
+                                             '( face help-key-binding
+                                                font-lock-face
help-key-binding))
                         (delete-char 1))



reply via email to

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