diff options
| author | Clément Pit-Claudel | 2019-10-16 21:28:47 -0400 |
|---|---|---|
| committer | Clément Pit-Claudel | 2019-10-20 21:48:38 -0400 |
| commit | 435eb82e7b7e8926a3675bac74713e7c6081f7db (patch) | |
| tree | 1bfd9f8f06e8c7b766533fa7ba06937b60d0028d /src | |
| parent | 9e15df208c19ca5aafd33a6cf801e7183543480e (diff) | |
| download | emacs-435eb82e7b7e8926a3675bac74713e7c6081f7db.tar.gz emacs-435eb82e7b7e8926a3675bac74713e7c6081f7db.zip | |
Add a way to disable substitution of command keys in help strings
* src/keyboard.c (help_echo_substitute_command_keys): New function.
(help_echo_echo, parse_menu_item): Use it.
(syms_of_keyboard): Define Qhelp_echo_inhibit_substitution.
* doc/lispref/text.texi (Special Properties), etc/NEWS: Document
the effect of 'help-echo-inhibit-substitution'.
Diffstat (limited to 'src')
| -rw-r--r-- | src/keyboard.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/src/keyboard.c b/src/keyboard.c index db583ec530e..56ab79068ad 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -2019,6 +2019,22 @@ make_ctrl_char (int c) | |||
| 2019 | return c; | 2019 | return c; |
| 2020 | } | 2020 | } |
| 2021 | 2021 | ||
| 2022 | /* Substitute key descriptions and quotes in HELP, unless its first | ||
| 2023 | character has a non-nil help-echo-inhibit-substitution property. */ | ||
| 2024 | |||
| 2025 | static Lisp_Object | ||
| 2026 | help_echo_substitute_command_keys (Lisp_Object help) | ||
| 2027 | { | ||
| 2028 | if (STRINGP (help) | ||
| 2029 | && SCHARS (help) > 0 | ||
| 2030 | && !NILP (Fget_text_property (make_fixnum (0), | ||
| 2031 | Qhelp_echo_inhibit_substitution, | ||
| 2032 | help))) | ||
| 2033 | return help; | ||
| 2034 | |||
| 2035 | return Fsubstitute_command_keys (help); | ||
| 2036 | } | ||
| 2037 | |||
| 2022 | /* Display the help-echo property of the character after the mouse pointer. | 2038 | /* Display the help-echo property of the character after the mouse pointer. |
| 2023 | Either show it in the echo area, or call show-help-function to display | 2039 | Either show it in the echo area, or call show-help-function to display |
| 2024 | it by other means (maybe in a tooltip). | 2040 | it by other means (maybe in a tooltip). |
| @@ -2078,7 +2094,7 @@ show_help_echo (Lisp_Object help, Lisp_Object window, Lisp_Object object, | |||
| 2078 | if (STRINGP (help) || NILP (help)) | 2094 | if (STRINGP (help) || NILP (help)) |
| 2079 | { | 2095 | { |
| 2080 | if (!NILP (Vshow_help_function)) | 2096 | if (!NILP (Vshow_help_function)) |
| 2081 | call1 (Vshow_help_function, Fsubstitute_command_keys (help)); | 2097 | call1 (Vshow_help_function, help_echo_substitute_command_keys (help)); |
| 2082 | help_echo_showing_p = STRINGP (help); | 2098 | help_echo_showing_p = STRINGP (help); |
| 2083 | } | 2099 | } |
| 2084 | } | 2100 | } |
| @@ -7670,7 +7686,7 @@ parse_menu_item (Lisp_Object item, int inmenubar) | |||
| 7670 | if (CONSP (item) && STRINGP (XCAR (item))) | 7686 | if (CONSP (item) && STRINGP (XCAR (item))) |
| 7671 | { | 7687 | { |
| 7672 | ASET (item_properties, ITEM_PROPERTY_HELP, | 7688 | ASET (item_properties, ITEM_PROPERTY_HELP, |
| 7673 | Fsubstitute_command_keys (XCAR (item))); | 7689 | help_echo_substitute_command_keys (XCAR (item))); |
| 7674 | start = item; | 7690 | start = item; |
| 7675 | item = XCDR (item); | 7691 | item = XCDR (item); |
| 7676 | } | 7692 | } |
| @@ -7734,7 +7750,7 @@ parse_menu_item (Lisp_Object item, int inmenubar) | |||
| 7734 | { | 7750 | { |
| 7735 | Lisp_Object help = XCAR (item); | 7751 | Lisp_Object help = XCAR (item); |
| 7736 | if (STRINGP (help)) | 7752 | if (STRINGP (help)) |
| 7737 | help = Fsubstitute_command_keys (help); | 7753 | help = help_echo_substitute_command_keys (help); |
| 7738 | ASET (item_properties, ITEM_PROPERTY_HELP, help); | 7754 | ASET (item_properties, ITEM_PROPERTY_HELP, help); |
| 7739 | } | 7755 | } |
| 7740 | else if (EQ (tem, QCfilter)) | 7756 | else if (EQ (tem, QCfilter)) |
| @@ -11455,6 +11471,7 @@ syms_of_keyboard (void) | |||
| 11455 | /* Tool-bars. */ | 11471 | /* Tool-bars. */ |
| 11456 | DEFSYM (QCimage, ":image"); | 11472 | DEFSYM (QCimage, ":image"); |
| 11457 | DEFSYM (Qhelp_echo, "help-echo"); | 11473 | DEFSYM (Qhelp_echo, "help-echo"); |
| 11474 | DEFSYM (Qhelp_echo_inhibit_substitution, "help-echo-inhibit-substitution"); | ||
| 11458 | DEFSYM (QCrtl, ":rtl"); | 11475 | DEFSYM (QCrtl, ":rtl"); |
| 11459 | 11476 | ||
| 11460 | staticpro (&item_properties); | 11477 | staticpro (&item_properties); |