diff options
author | Stefan Kangas <stefan@marxist.se> | 2021-03-08 03:29:42 +0100 |
---|---|---|
committer | Stefan Kangas <stefan@marxist.se> | 2021-03-08 04:23:08 +0100 |
commit | 4a112fd7a6f0dcbd1b99b811b324123f5699bdfb (patch) | |
tree | b3816a8ab7f3a05785ead1a590d0ab2dc5cd2921 /lisp/tooltip.el | |
parent | 8e103ebef12bb723723c7e6ec8e1053e86878a5b (diff) | |
download | emacs-4a112fd7a6f0dcbd1b99b811b324123f5699bdfb.tar.gz emacs-4a112fd7a6f0dcbd1b99b811b324123f5699bdfb.tar.bz2 emacs-4a112fd7a6f0dcbd1b99b811b324123f5699bdfb.zip |
Add new face 'help-key-binding' for keybindings in help
* lisp/faces.el (help-key-binding): New face.
* lisp/help.el
(help-for-help): Rename from 'help-for-help-internal'. Use
'substitute-command-keys' syntax.
(help): Make into alias for 'help-for-help'.
(help-for-help-internal): Make into obsolete alias for
'help-for-help'.
(help--key-description-fontified): New function to add the
'help-key-binding' face.
(help-key-description, substitute-command-keys)
(describe-map-tree, help--describe-command)
(help--describe-translation, describe-map):
* lisp/help-fns.el (help-fns--key-bindings, describe-mode):
Use above new function.
* lisp/isearch.el (isearch-help-for-help-internal): Use
`substitute-command-keys' syntax.
* lisp/help-macro.el (make-help-screen): Use
'substitute-command-keys' and 'help--key-description-fontified'.
Simplify.
* src/keymap.c (describe_key_maybe_fontify): New function to add
the 'help-key-binding' face to keybindings.
(describe_vector): Use above new keybinding.
(syms_of_keymap) <Qfont_lock_face, Qhelp_key_binding>: New
DEFSYMs.
(fontify_key_properties): New static variable.
* lisp/tooltip.el (tooltip-show): Avoid overriding faces in
specified tooltip text.
* test/lisp/help-tests.el (with-substitute-command-keys-test):
Don't test for text properties.
(help-tests-substitute-command-keys/add-key-face)
(help-tests-substitute-command-keys/add-key-face-listing):
New tests.
Diffstat (limited to 'lisp/tooltip.el')
-rw-r--r-- | lisp/tooltip.el | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lisp/tooltip.el b/lisp/tooltip.el index 8e00aa5c2a9..af3b86bba71 100644 --- a/lisp/tooltip.el +++ b/lisp/tooltip.el @@ -248,7 +248,12 @@ in echo area." (setf (alist-get 'border-color params) fg)) (when (stringp bg) (setf (alist-get 'background-color params) bg)) - (x-show-tip (propertize text 'face 'tooltip) + ;; Use non-nil APPEND argument below to avoid overriding any + ;; faces used in our TEXT. Among other things, this allows + ;; tooltips to use the `help-key-binding' face used in + ;; `substitute-command-keys' substitutions. + (add-face-text-property 0 (length text) 'tooltip t text) + (x-show-tip text (selected-frame) params tooltip-hide-delay |