diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/keyboard.c | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/src/keyboard.c b/src/keyboard.c index 78fcb6743ce..04ee068d454 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -148,6 +148,9 @@ int immediate_quit; | |||
| 148 | /* Character to recognize as the help char. */ | 148 | /* Character to recognize as the help char. */ |
| 149 | Lisp_Object Vhelp_char; | 149 | Lisp_Object Vhelp_char; |
| 150 | 150 | ||
| 151 | /* List of other event types to recognize as meaning "help". */ | ||
| 152 | Lisp_Object Vhelp_event_list; | ||
| 153 | |||
| 151 | /* Form to execute when help char is typed. */ | 154 | /* Form to execute when help char is typed. */ |
| 152 | Lisp_Object Vhelp_form; | 155 | Lisp_Object Vhelp_form; |
| 153 | 156 | ||
| @@ -563,7 +566,7 @@ echo_char (c) | |||
| 563 | } | 566 | } |
| 564 | 567 | ||
| 565 | if (current_kboard->echoptr == current_kboard->echobuf | 568 | if (current_kboard->echoptr == current_kboard->echobuf |
| 566 | && EQ (c, Vhelp_char)) | 569 | && help_char_p (c)) |
| 567 | { | 570 | { |
| 568 | strcpy (ptr, " (Type ? for further options)"); | 571 | strcpy (ptr, " (Type ? for further options)"); |
| 569 | ptr += strlen (ptr); | 572 | ptr += strlen (ptr); |
| @@ -2050,7 +2053,7 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu) | |||
| 2050 | num_input_chars++; | 2053 | num_input_chars++; |
| 2051 | 2054 | ||
| 2052 | /* Process the help character specially if enabled */ | 2055 | /* Process the help character specially if enabled */ |
| 2053 | if (EQ (c, Vhelp_char) && !NILP (Vhelp_form)) | 2056 | if (!NILP (Vhelp_form) && help_char_p (c)) |
| 2054 | { | 2057 | { |
| 2055 | Lisp_Object tem0; | 2058 | Lisp_Object tem0; |
| 2056 | count = specpdl_ptr - specpdl; | 2059 | count = specpdl_ptr - specpdl; |
| @@ -2082,6 +2085,22 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu) | |||
| 2082 | return c; | 2085 | return c; |
| 2083 | } | 2086 | } |
| 2084 | 2087 | ||
| 2088 | /* Return 1 if should recognize C as "the help character". */ | ||
| 2089 | |||
| 2090 | int | ||
| 2091 | help_char_p (c) | ||
| 2092 | Lisp_Object c; | ||
| 2093 | { | ||
| 2094 | Lisp_Object tail; | ||
| 2095 | |||
| 2096 | if (EQ (c, Vhelp_char)) | ||
| 2097 | return 1; | ||
| 2098 | for (tail = Vhelp_event_list; CONSP (tail); tail = XCONS (tail)->cdr) | ||
| 2099 | if (EQ (c, XCONS (tail)->car)) | ||
| 2100 | return 1; | ||
| 2101 | return 0; | ||
| 2102 | } | ||
| 2103 | |||
| 2085 | /* Record the input event C in various ways. */ | 2104 | /* Record the input event C in various ways. */ |
| 2086 | 2105 | ||
| 2087 | static void | 2106 | static void |
| @@ -5444,7 +5463,7 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last, | |||
| 5444 | Lisp_Object head; | 5463 | Lisp_Object head; |
| 5445 | 5464 | ||
| 5446 | head = EVENT_HEAD (key); | 5465 | head = EVENT_HEAD (key); |
| 5447 | if (EQ (head, Vhelp_char)) | 5466 | if (help_char_p (head)) |
| 5448 | { | 5467 | { |
| 5449 | read_key_sequence_cmd = Vprefix_help_command; | 5468 | read_key_sequence_cmd = Vprefix_help_command; |
| 5450 | keybuf[t++] = key; | 5469 | keybuf[t++] = key; |
| @@ -6965,6 +6984,11 @@ When it is read, do `(eval help-form)', and display result if it's a string.\n\ | |||
| 6965 | If the value of `help-form' is nil, this char can be read normally."); | 6984 | If the value of `help-form' is nil, this char can be read normally."); |
| 6966 | XSETINT (Vhelp_char, Ctl ('H')); | 6985 | XSETINT (Vhelp_char, Ctl ('H')); |
| 6967 | 6986 | ||
| 6987 | DEFVAR_LISP ("help-event-list", &Vhelp_event_list, | ||
| 6988 | "List of input events to recognize as meaning Help.\n\ | ||
| 6989 | These work just like the value of `help-char' (see that)."); | ||
| 6990 | Vhelp_event_list = Qnil; | ||
| 6991 | |||
| 6968 | DEFVAR_LISP ("help-form", &Vhelp_form, | 6992 | DEFVAR_LISP ("help-form", &Vhelp_form, |
| 6969 | "Form to execute when character `help-char' is read.\n\ | 6993 | "Form to execute when character `help-char' is read.\n\ |
| 6970 | If the form returns a string, that string is displayed.\n\ | 6994 | If the form returns a string, that string is displayed.\n\ |