diff options
| author | Richard M. Stallman | 2003-02-17 07:51:46 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2003-02-17 07:51:46 +0000 |
| commit | 63020c460102e3eafa8afb94b0292d7e4ecc63e6 (patch) | |
| tree | 0ae28519e714dea665d8ff8312eb670ecec8da00 /src | |
| parent | 7702ccc5293ac5fe21ee9de8aeb4b4688b62690b (diff) | |
| download | emacs-63020c460102e3eafa8afb94b0292d7e4ecc63e6.tar.gz emacs-63020c460102e3eafa8afb94b0292d7e4ecc63e6.zip | |
(this_command_key_count_reset): New variable.
Initiatize to 0 where this_command_key_count is set.
(read_char): Save and restore this_command_key_count_reset
around input method code.
(read_char): If this_command_key_count_reset, echo reread commands.
(Freset_this_command_lengths): Set this_command_key_count_reset to 1.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 9 | ||||
| -rw-r--r-- | src/keyboard.c | 41 |
2 files changed, 40 insertions, 10 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 535558bee2d..57d144c63bc 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,12 @@ | |||
| 1 | 2003-02-17 Richard M. Stallman <rms@gnu.org> | ||
| 2 | |||
| 3 | * keyboard.c (this_command_key_count_reset): New variable. | ||
| 4 | Initiatize to 0 where this_command_key_count is set. | ||
| 5 | (read_char): Save and restore this_command_key_count_reset | ||
| 6 | around input method code. | ||
| 7 | (read_char): If this_command_key_count_reset, echo reread commands. | ||
| 8 | (Freset_this_command_lengths): Set this_command_key_count_reset to 1. | ||
| 9 | |||
| 1 | 2003-02-17 Kenichi Handa <handa@m17n.org> | 10 | 2003-02-17 Kenichi Handa <handa@m17n.org> |
| 2 | 11 | ||
| 3 | * fns.c (string_to_multibyte): Always return a multibyte string. | 12 | * fns.c (string_to_multibyte): Always return a multibyte string. |
diff --git a/src/keyboard.c b/src/keyboard.c index c104c43e218..ec723e3c658 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -145,6 +145,10 @@ Lisp_Object recent_keys; /* A vector, holding the last 100 keystrokes */ | |||
| 145 | Lisp_Object this_command_keys; | 145 | Lisp_Object this_command_keys; |
| 146 | int this_command_key_count; | 146 | int this_command_key_count; |
| 147 | 147 | ||
| 148 | /* 1 after calling Freset_this_command_lengths. | ||
| 149 | Usually it is 0. */ | ||
| 150 | int this_command_key_count_reset; | ||
| 151 | |||
| 148 | /* This vector is used as a buffer to record the events that were actually read | 152 | /* This vector is used as a buffer to record the events that were actually read |
| 149 | by read_key_sequence. */ | 153 | by read_key_sequence. */ |
| 150 | Lisp_Object raw_keybuf; | 154 | Lisp_Object raw_keybuf; |
| @@ -1373,6 +1377,7 @@ command_loop_1 () | |||
| 1373 | 1377 | ||
| 1374 | nonundocount = 0; | 1378 | nonundocount = 0; |
| 1375 | this_command_key_count = 0; | 1379 | this_command_key_count = 0; |
| 1380 | this_command_key_count_reset = 0; | ||
| 1376 | this_single_command_key_start = 0; | 1381 | this_single_command_key_start = 0; |
| 1377 | 1382 | ||
| 1378 | if (NILP (Vmemory_full)) | 1383 | if (NILP (Vmemory_full)) |
| @@ -1505,6 +1510,7 @@ command_loop_1 () | |||
| 1505 | { | 1510 | { |
| 1506 | cancel_echoing (); | 1511 | cancel_echoing (); |
| 1507 | this_command_key_count = 0; | 1512 | this_command_key_count = 0; |
| 1513 | this_command_key_count_reset = 0; | ||
| 1508 | this_single_command_key_start = 0; | 1514 | this_single_command_key_start = 0; |
| 1509 | goto finalize; | 1515 | goto finalize; |
| 1510 | } | 1516 | } |
| @@ -1784,6 +1790,7 @@ command_loop_1 () | |||
| 1784 | current_kboard->Vreal_last_command = real_this_command; | 1790 | current_kboard->Vreal_last_command = real_this_command; |
| 1785 | cancel_echoing (); | 1791 | cancel_echoing (); |
| 1786 | this_command_key_count = 0; | 1792 | this_command_key_count = 0; |
| 1793 | this_command_key_count_reset = 0; | ||
| 1787 | this_single_command_key_start = 0; | 1794 | this_single_command_key_start = 0; |
| 1788 | } | 1795 | } |
| 1789 | 1796 | ||
| @@ -2384,6 +2391,8 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu) | |||
| 2384 | goto reread_for_input_method; | 2391 | goto reread_for_input_method; |
| 2385 | } | 2392 | } |
| 2386 | 2393 | ||
| 2394 | this_command_key_count_reset = 0; | ||
| 2395 | |||
| 2387 | if (!NILP (Vexecuting_macro)) | 2396 | if (!NILP (Vexecuting_macro)) |
| 2388 | { | 2397 | { |
| 2389 | /* We set this to Qmacro; since that's not a frame, nobody will | 2398 | /* We set this to Qmacro; since that's not a frame, nobody will |
| @@ -2949,7 +2958,7 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu) | |||
| 2949 | && (unsigned) XINT (c) < 256) | 2958 | && (unsigned) XINT (c) < 256) |
| 2950 | { | 2959 | { |
| 2951 | Lisp_Object keys; | 2960 | Lisp_Object keys; |
| 2952 | int key_count; | 2961 | int key_count, key_count_reset; |
| 2953 | struct gcpro gcpro1; | 2962 | struct gcpro gcpro1; |
| 2954 | int count = SPECPDL_INDEX (); | 2963 | int count = SPECPDL_INDEX (); |
| 2955 | 2964 | ||
| @@ -2971,6 +2980,7 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu) | |||
| 2971 | 2980 | ||
| 2972 | /* Save the this_command_keys status. */ | 2981 | /* Save the this_command_keys status. */ |
| 2973 | key_count = this_command_key_count; | 2982 | key_count = this_command_key_count; |
| 2983 | key_count_reset = this_command_key_count_reset; | ||
| 2974 | 2984 | ||
| 2975 | if (key_count > 0) | 2985 | if (key_count > 0) |
| 2976 | keys = Fcopy_sequence (this_command_keys); | 2986 | keys = Fcopy_sequence (this_command_keys); |
| @@ -2980,6 +2990,7 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu) | |||
| 2980 | 2990 | ||
| 2981 | /* Clear out this_command_keys. */ | 2991 | /* Clear out this_command_keys. */ |
| 2982 | this_command_key_count = 0; | 2992 | this_command_key_count = 0; |
| 2993 | this_command_key_count_reset = 0; | ||
| 2983 | 2994 | ||
| 2984 | /* Now wipe the echo area. */ | 2995 | /* Now wipe the echo area. */ |
| 2985 | if (!NILP (echo_area_buffer[0])) | 2996 | if (!NILP (echo_area_buffer[0])) |
| @@ -3002,6 +3013,7 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu) | |||
| 3002 | /* Restore the saved echoing state | 3013 | /* Restore the saved echoing state |
| 3003 | and this_command_keys state. */ | 3014 | and this_command_keys state. */ |
| 3004 | this_command_key_count = key_count; | 3015 | this_command_key_count = key_count; |
| 3016 | this_command_key_count_reset = key_count_reset; | ||
| 3005 | if (key_count > 0) | 3017 | if (key_count > 0) |
| 3006 | this_command_keys = keys; | 3018 | this_command_keys = keys; |
| 3007 | 3019 | ||
| @@ -3051,7 +3063,8 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu) | |||
| 3051 | goto retry; | 3063 | goto retry; |
| 3052 | } | 3064 | } |
| 3053 | 3065 | ||
| 3054 | if (this_command_key_count == 0 || ! reread) | 3066 | if (! reread || this_command_key_count == 0 |
| 3067 | || this_command_key_count_reset) | ||
| 3055 | { | 3068 | { |
| 3056 | 3069 | ||
| 3057 | /* Don't echo mouse motion events. */ | 3070 | /* Don't echo mouse motion events. */ |
| @@ -9404,6 +9417,7 @@ will read just one key sequence. */) | |||
| 9404 | if (NILP (continue_echo)) | 9417 | if (NILP (continue_echo)) |
| 9405 | { | 9418 | { |
| 9406 | this_command_key_count = 0; | 9419 | this_command_key_count = 0; |
| 9420 | this_command_key_count_reset = 0; | ||
| 9407 | this_single_command_key_start = 0; | 9421 | this_single_command_key_start = 0; |
| 9408 | } | 9422 | } |
| 9409 | 9423 | ||
| @@ -9463,6 +9477,7 @@ DEFUN ("read-key-sequence-vector", Fread_key_sequence_vector, | |||
| 9463 | if (NILP (continue_echo)) | 9477 | if (NILP (continue_echo)) |
| 9464 | { | 9478 | { |
| 9465 | this_command_key_count = 0; | 9479 | this_command_key_count = 0; |
| 9480 | this_command_key_count_reset = 0; | ||
| 9466 | this_single_command_key_start = 0; | 9481 | this_single_command_key_start = 0; |
| 9467 | } | 9482 | } |
| 9468 | 9483 | ||
| @@ -9656,6 +9671,7 @@ DEFUN ("execute-extended-command", Fexecute_extended_command, Sexecute_extended_ | |||
| 9656 | int i; | 9671 | int i; |
| 9657 | 9672 | ||
| 9658 | this_command_key_count = 0; | 9673 | this_command_key_count = 0; |
| 9674 | this_command_key_count_reset = 0; | ||
| 9659 | this_single_command_key_start = 0; | 9675 | this_single_command_key_start = 0; |
| 9660 | 9676 | ||
| 9661 | keys = XVECTOR (saved_keys)->contents; | 9677 | keys = XVECTOR (saved_keys)->contents; |
| @@ -9891,24 +9907,28 @@ The value is always a vector. */) | |||
| 9891 | 9907 | ||
| 9892 | DEFUN ("reset-this-command-lengths", Freset_this_command_lengths, | 9908 | DEFUN ("reset-this-command-lengths", Freset_this_command_lengths, |
| 9893 | Sreset_this_command_lengths, 0, 0, 0, | 9909 | Sreset_this_command_lengths, 0, 0, 0, |
| 9894 | doc: /* Used for complicated reasons in `universal-argument-other-key'. | 9910 | doc: /* Make the unread events replace the last command and echo. |
| 9911 | Used in `universal-argument-other-key'. | ||
| 9895 | 9912 | ||
| 9896 | `universal-argument-other-key' rereads the event just typed. | 9913 | `universal-argument-other-key' rereads the event just typed. |
| 9897 | It then gets translated through `function-key-map'. | 9914 | It then gets translated through `function-key-map'. |
| 9898 | The translated event gets included in the echo area and in | 9915 | The translated event has to replace the real events, |
| 9899 | the value of `this-command-keys' in addition to the raw original event. | 9916 | both in the value of (this-command-keys) and in echoing. |
| 9900 | That is not right. | 9917 | To achieve this, `universal-argument-other-key' calls |
| 9901 | 9918 | `reset-this-command-lengths', which discards the record of reading | |
| 9902 | Calling this function directs the translated event to replace | 9919 | these events the first time. */) |
| 9903 | the original event, so that only one version of the event actually | ||
| 9904 | appears in the echo area and in the value of `this-command-keys'. */) | ||
| 9905 | () | 9920 | () |
| 9906 | { | 9921 | { |
| 9907 | this_command_key_count = before_command_key_count; | 9922 | this_command_key_count = before_command_key_count; |
| 9908 | if (this_command_key_count < this_single_command_key_start) | 9923 | if (this_command_key_count < this_single_command_key_start) |
| 9909 | this_single_command_key_start = this_command_key_count; | 9924 | this_single_command_key_start = this_command_key_count; |
| 9925 | |||
| 9910 | echo_truncate (before_command_echo_length); | 9926 | echo_truncate (before_command_echo_length); |
| 9911 | 9927 | ||
| 9928 | /* Cause whatever we put into unread-command-events | ||
| 9929 | to echo as if it were being freshly read from the keyboard. */ | ||
| 9930 | this_command_key_count_reset = 1; | ||
| 9931 | |||
| 9912 | return Qnil; | 9932 | return Qnil; |
| 9913 | } | 9933 | } |
| 9914 | 9934 | ||
| @@ -9923,6 +9943,7 @@ KEEP-RECORD is non-nil. */) | |||
| 9923 | int i; | 9943 | int i; |
| 9924 | 9944 | ||
| 9925 | this_command_key_count = 0; | 9945 | this_command_key_count = 0; |
| 9946 | this_command_key_count_reset = 0; | ||
| 9926 | 9947 | ||
| 9927 | if (NILP (keep_record)) | 9948 | if (NILP (keep_record)) |
| 9928 | { | 9949 | { |