diff options
Diffstat (limited to 'src/keymap.c')
-rw-r--r-- | src/keymap.c | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/src/keymap.c b/src/keymap.c index 782931fadff..fb8eceaec18 100644 --- a/src/keymap.c +++ b/src/keymap.c @@ -2846,6 +2846,21 @@ DESCRIBER is the output function used; nil means use `princ'. */) return unbind_to (count, Qnil); } +static Lisp_Object fontify_key_properties; + +static Lisp_Object +describe_key_maybe_fontify (Lisp_Object str, Lisp_Object prefix, + bool keymap_p) +{ + Lisp_Object key_desc = Fkey_description (str, prefix); + if (keymap_p) + Fadd_text_properties (make_fixnum (0), + make_fixnum (SCHARS (key_desc)), + fontify_key_properties, + key_desc); + return key_desc; +} + DEFUN ("help--describe-vector", Fhelp__describe_vector, Shelp__describe_vector, 7, 7, 0, doc: /* Insert in the current buffer a description of the contents of VECTOR. Call DESCRIBER to insert the description of one value found in VECTOR. @@ -3021,7 +3036,7 @@ describe_vector (Lisp_Object vector, Lisp_Object prefix, Lisp_Object args, if (!NILP (elt_prefix)) insert1 (elt_prefix); - insert1 (Fkey_description (kludge, prefix)); + insert1 (describe_key_maybe_fontify (kludge, prefix, keymap_p)); /* Find all consecutive characters or rows that have the same definition. But, if VECTOR is a char-table, we had better @@ -3071,7 +3086,7 @@ describe_vector (Lisp_Object vector, Lisp_Object prefix, Lisp_Object args, if (!NILP (elt_prefix)) insert1 (elt_prefix); - insert1 (Fkey_description (kludge, prefix)); + insert1 (describe_key_maybe_fontify (kludge, prefix, keymap_p)); } /* Print a description of the definition of this character. @@ -3133,12 +3148,6 @@ syms_of_keymap (void) doc: /* Default keymap to use when reading from the minibuffer. */); Vminibuffer_local_map = Fmake_sparse_keymap (Qnil); - DEFVAR_LISP ("minibuffer-local-ns-map", Vminibuffer_local_ns_map, - doc: /* Local keymap for the minibuffer when spaces are not allowed. */); - Vminibuffer_local_ns_map = Fmake_sparse_keymap (Qnil); - Fset_keymap_parent (Vminibuffer_local_ns_map, Vminibuffer_local_map); - - DEFVAR_LISP ("minor-mode-map-alist", Vminor_mode_map_alist, doc: /* Alist of keymaps to use for minor modes. Each element looks like (VARIABLE . KEYMAP); KEYMAP is used to read @@ -3200,6 +3209,12 @@ be preferred. */); staticpro (&where_is_cache); staticpro (&where_is_cache_keymaps); + DEFSYM (Qfont_lock_face, "font-lock-face"); + DEFSYM (Qhelp_key_binding, "help-key-binding"); + staticpro (&fontify_key_properties); + fontify_key_properties = Fcons (Qfont_lock_face, + Fcons (Qhelp_key_binding, Qnil)); + defsubr (&Skeymapp); defsubr (&Skeymap_parent); defsubr (&Skeymap_prompt); |