diff options
| author | Richard M. Stallman | 1994-01-26 07:22:11 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-01-26 07:22:11 +0000 |
| commit | 40932d1ae95eb289ea483a012f5479878338c99c (patch) | |
| tree | 698262f9342d83444a9784468f5ad2529ee4e73d /src | |
| parent | 18686d472bdb9124009c741e03f04cfc9e2e31fa (diff) | |
| download | emacs-40932d1ae95eb289ea483a012f5479878338c99c.tar.gz emacs-40932d1ae95eb289ea483a012f5479878338c99c.zip | |
(read_key_sequence): Properly gcpro fkey_map while using keytran_map.
(syms_of_keyboard): New Lisp var command-hook-internal.
(command_loop_1): Use it when running the command hooks.
(read_key_sequence): Don't call echo_truncate the first time through.
(echo_truncate): Call truncate_echo_area.
Diffstat (limited to 'src')
| -rw-r--r-- | src/keyboard.c | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/src/keyboard.c b/src/keyboard.c index 9c302dba8ae..7213b20b6f0 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -282,6 +282,7 @@ Lisp_Object Qrecompute_lucid_menubar, Qactivate_menubar_hook; | |||
| 282 | /* Hooks to run before and after each command. */ | 282 | /* Hooks to run before and after each command. */ |
| 283 | Lisp_Object Qpre_command_hook, Qpost_command_hook; | 283 | Lisp_Object Qpre_command_hook, Qpost_command_hook; |
| 284 | Lisp_Object Vpre_command_hook, Vpost_command_hook; | 284 | Lisp_Object Vpre_command_hook, Vpost_command_hook; |
| 285 | Lisp_Object Qcommand_hook_internal, Vcommand_hook_internal; | ||
| 285 | 286 | ||
| 286 | /* File in which we write all commands we read. */ | 287 | /* File in which we write all commands we read. */ |
| 287 | FILE *dribble; | 288 | FILE *dribble; |
| @@ -609,6 +610,7 @@ echo_truncate (len) | |||
| 609 | { | 610 | { |
| 610 | echobuf[len] = '\0'; | 611 | echobuf[len] = '\0'; |
| 611 | echoptr = echobuf + len; | 612 | echoptr = echobuf + len; |
| 613 | truncate_echo_area (len); | ||
| 612 | } | 614 | } |
| 613 | 615 | ||
| 614 | 616 | ||
| @@ -908,15 +910,14 @@ command_loop_1 () | |||
| 908 | throw to top level. */ | 910 | throw to top level. */ |
| 909 | if (!NILP (Vpost_command_hook)) | 911 | if (!NILP (Vpost_command_hook)) |
| 910 | { | 912 | { |
| 911 | Lisp_Object tem; | ||
| 912 | /* If we get an error during the post-command-hook, | 913 | /* If we get an error during the post-command-hook, |
| 913 | cause post-command-hook to be nil. */ | 914 | cause post-command-hook to be nil. */ |
| 914 | tem = Vpost_command_hook; | 915 | Vcommand_hook_internal = Vpost_command_hook; |
| 915 | Vpost_command_hook = Qnil; | 916 | Vpost_command_hook = Qnil; |
| 916 | 917 | ||
| 917 | call1 (Vrun_hooks, Qpost_command_hook); | 918 | call1 (Vrun_hooks, Qcommand_hook_internal); |
| 918 | 919 | ||
| 919 | Vpost_command_hook = tem; | 920 | Vpost_command_hook = Vcommand_hook_internal; |
| 920 | } | 921 | } |
| 921 | 922 | ||
| 922 | while (1) | 923 | while (1) |
| @@ -1050,7 +1051,10 @@ command_loop_1 () | |||
| 1050 | } | 1051 | } |
| 1051 | 1052 | ||
| 1052 | /* Do redisplay processing after this command except in special | 1053 | /* Do redisplay processing after this command except in special |
| 1053 | cases identified below that set no_redisplay to 1. */ | 1054 | cases identified below that set no_redisplay to 1. |
| 1055 | (actually, there's currently no way to prevent the redisplay, | ||
| 1056 | and no_redisplay is ignored. | ||
| 1057 | Perhaps someday we will really implement it. */ | ||
| 1054 | no_redisplay = 0; | 1058 | no_redisplay = 0; |
| 1055 | 1059 | ||
| 1056 | prev_buffer = current_buffer; | 1060 | prev_buffer = current_buffer; |
| @@ -1061,15 +1065,14 @@ command_loop_1 () | |||
| 1061 | this_command = cmd; | 1065 | this_command = cmd; |
| 1062 | if (!NILP (Vpre_command_hook)) | 1066 | if (!NILP (Vpre_command_hook)) |
| 1063 | { | 1067 | { |
| 1064 | Lisp_Object tem; | ||
| 1065 | /* If we get an error during the pre-command-hook, | 1068 | /* If we get an error during the pre-command-hook, |
| 1066 | cause pre-command-hook to be nil. */ | 1069 | cause pre-command-hook to be nil. */ |
| 1067 | tem = Vpre_command_hook; | 1070 | Vcommand_hook_internal = Vpre_command_hook; |
| 1068 | Vpre_command_hook = Qnil; | 1071 | Vpre_command_hook = Qnil; |
| 1069 | 1072 | ||
| 1070 | call1 (Vrun_hooks, Qpre_command_hook); | 1073 | call1 (Vrun_hooks, Qcommand_hook_internal); |
| 1071 | 1074 | ||
| 1072 | Vpre_command_hook = tem; | 1075 | Vpre_command_hook = Vcommand_hook_internal; |
| 1073 | } | 1076 | } |
| 1074 | 1077 | ||
| 1075 | if (NILP (this_command)) | 1078 | if (NILP (this_command)) |
| @@ -3760,7 +3763,7 @@ read_char_minibuf_menu_prompt(commandflag, nmaps, maps) | |||
| 3760 | if (mapno == nmaps) | 3763 | if (mapno == nmaps) |
| 3761 | { | 3764 | { |
| 3762 | mapno = 0; | 3765 | mapno = 0; |
| 3763 | if ( notfirst || nobindings ) break; | 3766 | if (notfirst || nobindings) break; |
| 3764 | } | 3767 | } |
| 3765 | rest = maps[mapno]; | 3768 | rest = maps[mapno]; |
| 3766 | } | 3769 | } |
| @@ -4186,7 +4189,7 @@ read_key_sequence (keybuf, bufsize, prompt) | |||
| 4186 | /* These are no-ops the first time through, but if we restart, they | 4189 | /* These are no-ops the first time through, but if we restart, they |
| 4187 | revert the echo area and this_command_keys to their original state. */ | 4190 | revert the echo area and this_command_keys to their original state. */ |
| 4188 | this_command_key_count = keys_start; | 4191 | this_command_key_count = keys_start; |
| 4189 | if (INTERACTIVE) | 4192 | if (INTERACTIVE && t < mock_input) |
| 4190 | echo_truncate (echo_start); | 4193 | echo_truncate (echo_start); |
| 4191 | 4194 | ||
| 4192 | /* If the best binding for the current key sequence is a keymap, or | 4195 | /* If the best binding for the current key sequence is a keymap, or |
| @@ -4237,7 +4240,7 @@ read_key_sequence (keybuf, bufsize, prompt) | |||
| 4237 | jumped back up to replay_key; in that case, these restore the | 4240 | jumped back up to replay_key; in that case, these restore the |
| 4238 | variables to their original state, allowing us to replay the | 4241 | variables to their original state, allowing us to replay the |
| 4239 | loop. */ | 4242 | loop. */ |
| 4240 | if (INTERACTIVE) | 4243 | if (INTERACTIVE && t < mock_input) |
| 4241 | echo_truncate (echo_local_start); | 4244 | echo_truncate (echo_local_start); |
| 4242 | this_command_key_count = keys_local_start; | 4245 | this_command_key_count = keys_local_start; |
| 4243 | first_binding = local_first_binding; | 4246 | first_binding = local_first_binding; |
| @@ -4685,7 +4688,7 @@ read_key_sequence (keybuf, bufsize, prompt) | |||
| 4685 | Lisp_Object tem; | 4688 | Lisp_Object tem; |
| 4686 | tem = keytran_next; | 4689 | tem = keytran_next; |
| 4687 | 4690 | ||
| 4688 | GCPRO3 (keytran_map, keytran_map, delayed_switch_frame); | 4691 | GCPRO3 (fkey_map, keytran_map, delayed_switch_frame); |
| 4689 | keytran_next = call1 (keytran_next, prompt); | 4692 | keytran_next = call1 (keytran_next, prompt); |
| 4690 | UNGCPRO; | 4693 | UNGCPRO; |
| 4691 | /* If the function returned something invalid, | 4694 | /* If the function returned something invalid, |
| @@ -4693,7 +4696,7 @@ read_key_sequence (keybuf, bufsize, prompt) | |||
| 4693 | (To ignore it safely, we would need to gcpro a bunch of | 4696 | (To ignore it safely, we would need to gcpro a bunch of |
| 4694 | other variables.) */ | 4697 | other variables.) */ |
| 4695 | if (! (VECTORP (keytran_next) || STRINGP (keytran_next))) | 4698 | if (! (VECTORP (keytran_next) || STRINGP (keytran_next))) |
| 4696 | error ("Function in function-key-map returns invalid key sequence"); | 4699 | error ("Function in key-translation-map returns invalid key sequence"); |
| 4697 | } | 4700 | } |
| 4698 | 4701 | ||
| 4699 | /* If keybuf[keytran_start..keytran_end] is bound in the | 4702 | /* If keybuf[keytran_start..keytran_end] is bound in the |
| @@ -5545,6 +5548,9 @@ syms_of_keyboard () | |||
| 5545 | Qpost_command_hook = intern ("post-command-hook"); | 5548 | Qpost_command_hook = intern ("post-command-hook"); |
| 5546 | staticpro (&Qpost_command_hook); | 5549 | staticpro (&Qpost_command_hook); |
| 5547 | 5550 | ||
| 5551 | Qcommand_hook_internal = intern ("command-hook-internal"); | ||
| 5552 | staticpro (&Qcommand_hook_internal); | ||
| 5553 | |||
| 5548 | Qfunction_key = intern ("function-key"); | 5554 | Qfunction_key = intern ("function-key"); |
| 5549 | staticpro (&Qfunction_key); | 5555 | staticpro (&Qfunction_key); |
| 5550 | Qmouse_click = intern ("mouse-click"); | 5556 | Qmouse_click = intern ("mouse-click"); |