diff options
| author | Richard M. Stallman | 1998-08-18 11:12:25 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1998-08-18 11:12:25 +0000 |
| commit | b638f328462cc23405bdccfd6ba313b4c66d96e3 (patch) | |
| tree | 9d93d6a3568f41d95b633a9548df6770de5c64a9 /src | |
| parent | 7a983715c8799d68773caa7b760b89a6d584a28f (diff) | |
| download | emacs-b638f328462cc23405bdccfd6ba313b4c66d96e3.tar.gz emacs-b638f328462cc23405bdccfd6ba313b4c66d96e3.zip | |
(read_char): If not reading a key sequence (MAPS is nil),
bind input-method-exit-on-first-char and input-method-use-echo-area
to t.
(read_char): If PREV_EVENT is non-nil, don't run the input method.
(read_key_sequence): Do not bind input-method-function.
Diffstat (limited to 'src')
| -rw-r--r-- | src/keyboard.c | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/src/keyboard.c b/src/keyboard.c index dc264fc62f8..a38e9809793 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -1778,7 +1778,10 @@ static jmp_buf wrong_kboard_jmpbuf; | |||
| 1778 | MAPS is an array of keymaps; NMAPS is the length of MAPS. | 1778 | MAPS is an array of keymaps; NMAPS is the length of MAPS. |
| 1779 | 1779 | ||
| 1780 | PREV_EVENT is the previous input event, or nil if we are reading | 1780 | PREV_EVENT is the previous input event, or nil if we are reading |
| 1781 | the first event of a key sequence. | 1781 | the first event of a key sequence (or not reading a key sequence). |
| 1782 | If PREV_EVENT is t, that is a "magic" value that says | ||
| 1783 | not to run input methods, but in other respects to act as if | ||
| 1784 | not reading a key sequence. | ||
| 1782 | 1785 | ||
| 1783 | If USED_MOUSE_MENU is non-null, then we set *USED_MOUSE_MENU to 1 | 1786 | If USED_MOUSE_MENU is non-null, then we set *USED_MOUSE_MENU to 1 |
| 1784 | if we used a mouse menu to read the input, or zero otherwise. If | 1787 | if we used a mouse menu to read the input, or zero otherwise. If |
| @@ -2359,12 +2362,16 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu) | |||
| 2359 | /* Pass this to the input method, if appropriate. */ | 2362 | /* Pass this to the input method, if appropriate. */ |
| 2360 | if (INTEGERP (c) | 2363 | if (INTEGERP (c) |
| 2361 | && ! NILP (Vinput_method_function) | 2364 | && ! NILP (Vinput_method_function) |
| 2365 | /* Don't run the input method within a key sequence, | ||
| 2366 | after the first event of the key sequence. */ | ||
| 2367 | && NILP (prev_event) | ||
| 2362 | && (unsigned) XINT (c) >= ' ' | 2368 | && (unsigned) XINT (c) >= ' ' |
| 2363 | && (unsigned) XINT (c) < 127) | 2369 | && (unsigned) XINT (c) < 127) |
| 2364 | { | 2370 | { |
| 2365 | Lisp_Object keys; | 2371 | Lisp_Object keys; |
| 2366 | int key_count; | 2372 | int key_count; |
| 2367 | struct gcpro gcpro1; | 2373 | struct gcpro gcpro1; |
| 2374 | int count = specpdl_ptr - specpdl; | ||
| 2368 | 2375 | ||
| 2369 | /* Save the echo status. */ | 2376 | /* Save the echo status. */ |
| 2370 | int saved_immediate_echo = current_kboard->immediate_echo; | 2377 | int saved_immediate_echo = current_kboard->immediate_echo; |
| @@ -2398,9 +2405,19 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu) | |||
| 2398 | echo_area_glyphs = 0; | 2405 | echo_area_glyphs = 0; |
| 2399 | echo_truncate (0); | 2406 | echo_truncate (0); |
| 2400 | 2407 | ||
| 2408 | /* If we are not reading a key sequence, | ||
| 2409 | never use the echo area. */ | ||
| 2410 | if (maps == 0) | ||
| 2411 | { | ||
| 2412 | specbind (Qinput_method_exit_on_first_char, Qt); | ||
| 2413 | specbind (Qinput_method_use_echo_area, Qt); | ||
| 2414 | } | ||
| 2415 | |||
| 2401 | /* Call the input method. */ | 2416 | /* Call the input method. */ |
| 2402 | tem = call1 (Vinput_method_function, c); | 2417 | tem = call1 (Vinput_method_function, c); |
| 2403 | 2418 | ||
| 2419 | tem = unbind_to (count, tem); | ||
| 2420 | |||
| 2404 | /* Restore the saved echoing state | 2421 | /* Restore the saved echoing state |
| 2405 | and this_command_keys state. */ | 2422 | and this_command_keys state. */ |
| 2406 | this_command_key_count = key_count; | 2423 | this_command_key_count = key_count; |
| @@ -6773,10 +6790,6 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last, | |||
| 6773 | 6790 | ||
| 6774 | orig_local_map = get_local_map (PT, current_buffer); | 6791 | orig_local_map = get_local_map (PT, current_buffer); |
| 6775 | 6792 | ||
| 6776 | /* Bind input-method-function so that we can set it to nil | ||
| 6777 | temporarily after the first input event. */ | ||
| 6778 | specbind (Qinput_method_function, Vinput_method_function); | ||
| 6779 | |||
| 6780 | /* We jump here when the key sequence has been thoroughly changed, and | 6793 | /* We jump here when the key sequence has been thoroughly changed, and |
| 6781 | we need to rescan it starting from the beginning. When we jump here, | 6794 | we need to rescan it starting from the beginning. When we jump here, |
| 6782 | keybuf[0..mock_input] holds the sequence we should reread. */ | 6795 | keybuf[0..mock_input] holds the sequence we should reread. */ |
| @@ -6948,9 +6961,6 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last, | |||
| 6948 | #endif | 6961 | #endif |
| 6949 | key = read_char (NILP (prompt), nmaps, submaps, last_nonmenu_event, | 6962 | key = read_char (NILP (prompt), nmaps, submaps, last_nonmenu_event, |
| 6950 | &used_mouse_menu); | 6963 | &used_mouse_menu); |
| 6951 | |||
| 6952 | /* Turn off input methods after a prefix character. */ | ||
| 6953 | Vinput_method_function = Qnil; | ||
| 6954 | } | 6964 | } |
| 6955 | 6965 | ||
| 6956 | /* read_char returns t when it shows a menu and the user rejects it. | 6966 | /* read_char returns t when it shows a menu and the user rejects it. |
| @@ -7692,7 +7702,7 @@ The optional fifth argument COMMAND-LOOP, if non-nil, means\n\ | |||
| 7692 | that this key sequence is being read by something that will\n\ | 7702 | that this key sequence is being read by something that will\n\ |
| 7693 | read commands one after another. It should be nil if the caller\n\ | 7703 | read commands one after another. It should be nil if the caller\n\ |
| 7694 | will read just one key sequence.") | 7704 | will read just one key sequence.") |
| 7695 | (prompt, continue_echo, dont_downcase_last, can_return_switch_frame) | 7705 | (prompt, continue_echo, dont_downcase_last, can_return_switch_frame, command-loop) |
| 7696 | #endif | 7706 | #endif |
| 7697 | 7707 | ||
| 7698 | DEFUN ("read-key-sequence", Fread_key_sequence, Sread_key_sequence, 1, 5, 0, | 7708 | DEFUN ("read-key-sequence", Fread_key_sequence, Sread_key_sequence, 1, 5, 0, |