diff options
| author | Richard M. Stallman | 1994-08-02 01:33:48 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-08-02 01:33:48 +0000 |
| commit | 4e50f26a071e01431a6f42a39949b136ba469d80 (patch) | |
| tree | 56c6c7d327911f3dbe5ac0150483d8e61826f488 /src | |
| parent | f67a0f51a55bfab32b772a387160398c6399aa34 (diff) | |
| download | emacs-4e50f26a071e01431a6f42a39949b136ba469d80.tar.gz emacs-4e50f26a071e01431a6f42a39949b136ba469d80.zip | |
(follow_key): Don't downcase letters here.
Delete arg `case_converted'.
(read_key_sequence): Do it here; but not if in middle of fcn key.
Diffstat (limited to 'src')
| -rw-r--r-- | src/keyboard.c | 78 |
1 files changed, 27 insertions, 51 deletions
diff --git a/src/keyboard.c b/src/keyboard.c index 391d8718f78..66b75ea6ea8 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -4218,23 +4218,16 @@ read_char_minibuf_menu_prompt (commandflag, nmaps, maps) | |||
| 4218 | CURRENT with non-prefix bindings for meta-prefix-char become nil in | 4218 | CURRENT with non-prefix bindings for meta-prefix-char become nil in |
| 4219 | NEXT. | 4219 | NEXT. |
| 4220 | 4220 | ||
| 4221 | When KEY is not defined in any of the keymaps, if it is an upper | ||
| 4222 | case letter and there are bindings for the corresponding lower-case | ||
| 4223 | letter, return the bindings for the lower-case letter. | ||
| 4224 | We store 1 in *CASE_CONVERTED in this case. | ||
| 4225 | Otherwise, we don't change *CASE_CONVERTED. | ||
| 4226 | |||
| 4227 | If KEY has no bindings in any of the CURRENT maps, NEXT is left | 4221 | If KEY has no bindings in any of the CURRENT maps, NEXT is left |
| 4228 | unmodified. | 4222 | unmodified. |
| 4229 | 4223 | ||
| 4230 | NEXT may == CURRENT. */ | 4224 | NEXT may == CURRENT. */ |
| 4231 | 4225 | ||
| 4232 | static int | 4226 | static int |
| 4233 | follow_key (key, nmaps, current, defs, next, case_converted) | 4227 | follow_key (key, nmaps, current, defs, next) |
| 4234 | Lisp_Object key; | 4228 | Lisp_Object key; |
| 4235 | Lisp_Object *current, *defs, *next; | 4229 | Lisp_Object *current, *defs, *next; |
| 4236 | int nmaps; | 4230 | int nmaps; |
| 4237 | int *case_converted; | ||
| 4238 | { | 4231 | { |
| 4239 | int i, first_binding; | 4232 | int i, first_binding; |
| 4240 | 4233 | ||
| @@ -4273,38 +4266,6 @@ follow_key (key, nmaps, current, defs, next, case_converted) | |||
| 4273 | defs[i] = Qnil; | 4266 | defs[i] = Qnil; |
| 4274 | } | 4267 | } |
| 4275 | 4268 | ||
| 4276 | /* When KEY is not defined in any of the keymaps, if it is an upper | ||
| 4277 | case letter and there are bindings for the corresponding | ||
| 4278 | lower-case letter, return the bindings for the lower-case letter. */ | ||
| 4279 | if (first_binding == nmaps | ||
| 4280 | && XTYPE (key) == Lisp_Int | ||
| 4281 | && ((((XINT (key) & 0x3ffff) | ||
| 4282 | < XSTRING (current_buffer->downcase_table)->size) | ||
| 4283 | && UPPERCASEP (XINT (key) & 0x3ffff)) | ||
| 4284 | || (XINT (key) & shift_modifier))) | ||
| 4285 | { | ||
| 4286 | if (XINT (key) & shift_modifier) | ||
| 4287 | XSETINT (key, XINT (key) & ~shift_modifier); | ||
| 4288 | else | ||
| 4289 | XSETINT (key, (DOWNCASE (XINT (key) & 0x3ffff) | ||
| 4290 | | (XINT (key) & ~0x3ffff))); | ||
| 4291 | |||
| 4292 | first_binding = nmaps; | ||
| 4293 | for (i = nmaps - 1; i >= 0; i--) | ||
| 4294 | { | ||
| 4295 | if (! NILP (current[i])) | ||
| 4296 | { | ||
| 4297 | defs[i] = get_keyelt (access_keymap (current[i], key, 1, 0)); | ||
| 4298 | if (! NILP (defs[i])) | ||
| 4299 | first_binding = i; | ||
| 4300 | } | ||
| 4301 | else | ||
| 4302 | defs[i] = Qnil; | ||
| 4303 | } | ||
| 4304 | if (first_binding != nmaps) | ||
| 4305 | *case_converted = 1; | ||
| 4306 | } | ||
| 4307 | |||
| 4308 | /* Given the set of bindings we've found, produce the next set of maps. */ | 4269 | /* Given the set of bindings we've found, produce the next set of maps. */ |
| 4309 | if (first_binding < nmaps) | 4270 | if (first_binding < nmaps) |
| 4310 | for (i = 0; i < nmaps; i++) | 4271 | for (i = 0; i < nmaps; i++) |
| @@ -4422,10 +4383,6 @@ read_key_sequence (keybuf, bufsize, prompt) | |||
| 4422 | 4383 | ||
| 4423 | struct buffer *starting_buffer; | 4384 | struct buffer *starting_buffer; |
| 4424 | 4385 | ||
| 4425 | /* Nonzero if we found the binding for one of the chars | ||
| 4426 | in this key sequence by downcasing it. */ | ||
| 4427 | int case_converted = 0; | ||
| 4428 | |||
| 4429 | /* Nonzero if we seem to have got the beginning of a binding | 4386 | /* Nonzero if we seem to have got the beginning of a binding |
| 4430 | in function_key_map. */ | 4387 | in function_key_map. */ |
| 4431 | int function_key_possible = 0; | 4388 | int function_key_possible = 0; |
| @@ -4479,7 +4436,6 @@ read_key_sequence (keybuf, bufsize, prompt) | |||
| 4479 | replay_sequence: | 4436 | replay_sequence: |
| 4480 | 4437 | ||
| 4481 | starting_buffer = current_buffer; | 4438 | starting_buffer = current_buffer; |
| 4482 | case_converted = 0; | ||
| 4483 | function_key_possible = 0; | 4439 | function_key_possible = 0; |
| 4484 | 4440 | ||
| 4485 | /* Build our list of keymaps. | 4441 | /* Build our list of keymaps. |
| @@ -4551,7 +4507,7 @@ read_key_sequence (keybuf, bufsize, prompt) | |||
| 4551 | Thus, if ESC O a has a function-key-map translation | 4507 | Thus, if ESC O a has a function-key-map translation |
| 4552 | and ESC o has a binding, don't return after ESC O, | 4508 | and ESC o has a binding, don't return after ESC O, |
| 4553 | so that we can translate ESC O plus the next character. */ | 4509 | so that we can translate ESC O plus the next character. */ |
| 4554 | || (function_key_possible && case_converted)) | 4510 | ) |
| 4555 | { | 4511 | { |
| 4556 | Lisp_Object key; | 4512 | Lisp_Object key; |
| 4557 | int used_mouse_menu = 0; | 4513 | int used_mouse_menu = 0; |
| @@ -4781,8 +4737,7 @@ read_key_sequence (keybuf, bufsize, prompt) | |||
| 4781 | nmaps - first_binding, | 4737 | nmaps - first_binding, |
| 4782 | submaps + first_binding, | 4738 | submaps + first_binding, |
| 4783 | defs + first_binding, | 4739 | defs + first_binding, |
| 4784 | submaps + first_binding, | 4740 | submaps + first_binding) |
| 4785 | &case_converted) | ||
| 4786 | + first_binding); | 4741 | + first_binding); |
| 4787 | 4742 | ||
| 4788 | /* If KEY wasn't bound, we'll try some fallbacks. */ | 4743 | /* If KEY wasn't bound, we'll try some fallbacks. */ |
| @@ -4884,8 +4839,7 @@ read_key_sequence (keybuf, bufsize, prompt) | |||
| 4884 | nmaps - local_first_binding, | 4839 | nmaps - local_first_binding, |
| 4885 | submaps + local_first_binding, | 4840 | submaps + local_first_binding, |
| 4886 | defs + local_first_binding, | 4841 | defs + local_first_binding, |
| 4887 | submaps + local_first_binding, | 4842 | submaps + local_first_binding) |
| 4888 | &case_converted) | ||
| 4889 | + local_first_binding); | 4843 | + local_first_binding); |
| 4890 | 4844 | ||
| 4891 | /* If that click is bound, go for it. */ | 4845 | /* If that click is bound, go for it. */ |
| @@ -4912,7 +4866,7 @@ read_key_sequence (keybuf, bufsize, prompt) | |||
| 4912 | off the end of it. We only want to scan real keyboard input | 4866 | off the end of it. We only want to scan real keyboard input |
| 4913 | for function key sequences, so if mock_input says that we're | 4867 | for function key sequences, so if mock_input says that we're |
| 4914 | re-reading old events, don't examine it. */ | 4868 | re-reading old events, don't examine it. */ |
| 4915 | if ((first_binding >= nmaps || case_converted) | 4869 | if (first_binding >= nmaps |
| 4916 | && t >= mock_input) | 4870 | && t >= mock_input) |
| 4917 | { | 4871 | { |
| 4918 | Lisp_Object fkey_next; | 4872 | Lisp_Object fkey_next; |
| @@ -5111,6 +5065,28 @@ read_key_sequence (keybuf, bufsize, prompt) | |||
| 5111 | } | 5065 | } |
| 5112 | } | 5066 | } |
| 5113 | } | 5067 | } |
| 5068 | |||
| 5069 | /* If KEY is not defined in any of the keymaps, | ||
| 5070 | and cannot be part of a function key or translation, | ||
| 5071 | and is an upper case letter | ||
| 5072 | use the corresponding lower-case letter instead. */ | ||
| 5073 | if (first_binding == nmaps && ! function_key_possible | ||
| 5074 | && XTYPE (key) == Lisp_Int | ||
| 5075 | && ((((XINT (key) & 0x3ffff) | ||
| 5076 | < XSTRING (current_buffer->downcase_table)->size) | ||
| 5077 | && UPPERCASEP (XINT (key) & 0x3ffff)) | ||
| 5078 | || (XINT (key) & shift_modifier))) | ||
| 5079 | { | ||
| 5080 | if (XINT (key) & shift_modifier) | ||
| 5081 | XSETINT (key, XINT (key) & ~shift_modifier); | ||
| 5082 | else | ||
| 5083 | XSETINT (key, (DOWNCASE (XINT (key) & 0x3ffff) | ||
| 5084 | | (XINT (key) & ~0x3ffff))); | ||
| 5085 | |||
| 5086 | keybuf[t - 1] = key; | ||
| 5087 | mock_input = t; | ||
| 5088 | goto replay_sequence; | ||
| 5089 | } | ||
| 5114 | } | 5090 | } |
| 5115 | 5091 | ||
| 5116 | read_key_sequence_cmd = (first_binding < nmaps | 5092 | read_key_sequence_cmd = (first_binding < nmaps |