diff options
| author | Richard M. Stallman | 1998-01-09 23:14:38 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1998-01-09 23:14:38 +0000 |
| commit | 301738ed7bd6cc3337bbd749f55542ff1ded5095 (patch) | |
| tree | 3dec8341878aeca6a6c886d97aba03a61428240b /src | |
| parent | e34c5c7daff4b2eb68e03e18cdd62dc7d76814d3 (diff) | |
| download | emacs-301738ed7bd6cc3337bbd749f55542ff1ded5095.tar.gz emacs-301738ed7bd6cc3337bbd749f55542ff1ded5095.zip | |
(echo_now): Use message2_nolog, not message1_nolog.
(Fexecute_extended_command): Likewise.
(read_char_minibuf_menu_prompt): Use message2_nolog, not message1.
(parse_modifiers): Use size_byte.
(echo_char): Use size_byte.
(parse_modifiers_uncached): Likewise.
(record_char): Likewise.
(parse_solitary_modifier): Likewise.
(read_char): Use Faref on Vkeyboard_translate_table
if it is a string.
(apply_modifiers_uncached): New arg base_len_byte. Calls changed.
(read_char_minibuf_menu_prompt):
(read_key_sequence): Access buffer's downcase_table with XCHAR_TABLE.
(Fexecute_extended_command): Use Faref to access FUNCTION.
Use size_byte of BINDING.
(stuff_buffered_input): Use size_byte of STUFFSTRING.
Diffstat (limited to 'src')
| -rw-r--r-- | src/keyboard.c | 88 |
1 files changed, 49 insertions, 39 deletions
diff --git a/src/keyboard.c b/src/keyboard.c index 248b85e97e2..7e640ae074d 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -614,10 +614,11 @@ echo_char (c) | |||
| 614 | else if (SYMBOLP (c)) | 614 | else if (SYMBOLP (c)) |
| 615 | { | 615 | { |
| 616 | struct Lisp_String *name = XSYMBOL (c)->name; | 616 | struct Lisp_String *name = XSYMBOL (c)->name; |
| 617 | if ((ptr - current_kboard->echobuf) + name->size + 4 > ECHOBUFSIZE) | 617 | if ((ptr - current_kboard->echobuf) + name->size_byte + 4 |
| 618 | > ECHOBUFSIZE) | ||
| 618 | return; | 619 | return; |
| 619 | bcopy (name->data, ptr, name->size); | 620 | bcopy (name->data, ptr, name->size_byte); |
| 620 | ptr += name->size; | 621 | ptr += name->size_byte; |
| 621 | } | 622 | } |
| 622 | 623 | ||
| 623 | if (current_kboard->echoptr == current_kboard->echobuf | 624 | if (current_kboard->echoptr == current_kboard->echobuf |
| @@ -681,7 +682,9 @@ echo_now () | |||
| 681 | } | 682 | } |
| 682 | 683 | ||
| 683 | echoing = 1; | 684 | echoing = 1; |
| 684 | message1_nolog (current_kboard->echobuf); | 685 | message2_nolog (current_kboard->echobuf, strlen (current_kboard->echobuf), |
| 686 | ! NILP (current_buffer->enable_multibyte_characters)); | ||
| 687 | |||
| 685 | echoing = 0; | 688 | echoing = 0; |
| 686 | 689 | ||
| 687 | if (waiting_for_input && !NILP (Vquit_flag)) | 690 | if (waiting_for_input && !NILP (Vquit_flag)) |
| @@ -945,6 +948,14 @@ cmd_error (data) | |||
| 945 | return make_number (0); | 948 | return make_number (0); |
| 946 | } | 949 | } |
| 947 | 950 | ||
| 951 | /* Take actions on handling an error. DATA is the data that describes | ||
| 952 | the error. | ||
| 953 | |||
| 954 | CONTEXT is a C-string containing ASCII characters only which | ||
| 955 | describes the context in which the error happened. If we need to | ||
| 956 | generalize CONTEXT to allow multibyte characters, make it a Lisp | ||
| 957 | string. */ | ||
| 958 | |||
| 948 | void | 959 | void |
| 949 | cmd_error_internal (data, context) | 960 | cmd_error_internal (data, context) |
| 950 | Lisp_Object data; | 961 | Lisp_Object data; |
| @@ -1158,7 +1169,7 @@ command_loop_1 () | |||
| 1158 | 1169 | ||
| 1159 | Fsit_for (make_number (2), Qnil, Qnil); | 1170 | Fsit_for (make_number (2), Qnil, Qnil); |
| 1160 | /* Clear the echo area. */ | 1171 | /* Clear the echo area. */ |
| 1161 | message2 (0, 0); | 1172 | message2 (0, 0, 0); |
| 1162 | safe_run_hooks (Qecho_area_clear_hook); | 1173 | safe_run_hooks (Qecho_area_clear_hook); |
| 1163 | 1174 | ||
| 1164 | unbind_to (count, Qnil); | 1175 | unbind_to (count, Qnil); |
| @@ -2177,13 +2188,12 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu) | |||
| 2177 | if (XINT (c) == -1) | 2188 | if (XINT (c) == -1) |
| 2178 | RETURN_UNGCPRO (c); | 2189 | RETURN_UNGCPRO (c); |
| 2179 | 2190 | ||
| 2180 | if (STRINGP (Vkeyboard_translate_table) | 2191 | if ((STRINGP (Vkeyboard_translate_table) |
| 2181 | && XSTRING (Vkeyboard_translate_table)->size > (unsigned) XFASTINT (c)) | 2192 | && XSTRING (Vkeyboard_translate_table)->size > (unsigned) XFASTINT (c)) |
| 2182 | XSETINT (c, XSTRING (Vkeyboard_translate_table)->data[XFASTINT (c)]); | 2193 | || (VECTORP (Vkeyboard_translate_table) |
| 2183 | else if ((VECTORP (Vkeyboard_translate_table) | 2194 | && XVECTOR (Vkeyboard_translate_table)->size > (unsigned) XFASTINT (c)) |
| 2184 | && XVECTOR (Vkeyboard_translate_table)->size > (unsigned) XFASTINT (c)) | 2195 | || (CHAR_TABLE_P (Vkeyboard_translate_table) |
| 2185 | || (CHAR_TABLE_P (Vkeyboard_translate_table) | 2196 | && CHAR_TABLE_ORDINARY_SLOTS > (unsigned) XFASTINT (c))) |
| 2186 | && CHAR_TABLE_ORDINARY_SLOTS > (unsigned) XFASTINT (c))) | ||
| 2187 | { | 2197 | { |
| 2188 | Lisp_Object d; | 2198 | Lisp_Object d; |
| 2189 | d = Faref (Vkeyboard_translate_table, c); | 2199 | d = Faref (Vkeyboard_translate_table, c); |
| @@ -2366,7 +2376,7 @@ record_char (c) | |||
| 2366 | { | 2376 | { |
| 2367 | putc ('<', dribble); | 2377 | putc ('<', dribble); |
| 2368 | fwrite (XSYMBOL (dribblee)->name->data, sizeof (char), | 2378 | fwrite (XSYMBOL (dribblee)->name->data, sizeof (char), |
| 2369 | XSYMBOL (dribblee)->name->size, | 2379 | XSYMBOL (dribblee)->name->size_byte, |
| 2370 | dribble); | 2380 | dribble); |
| 2371 | putc ('>', dribble); | 2381 | putc ('>', dribble); |
| 2372 | } | 2382 | } |
| @@ -4328,7 +4338,7 @@ parse_modifiers_uncached (symbol, modifier_end) | |||
| 4328 | modifiers = 0; | 4338 | modifiers = 0; |
| 4329 | name = XSYMBOL (symbol)->name; | 4339 | name = XSYMBOL (symbol)->name; |
| 4330 | 4340 | ||
| 4331 | for (i = 0; i+2 <= name->size; ) | 4341 | for (i = 0; i+2 <= name->size_byte; ) |
| 4332 | { | 4342 | { |
| 4333 | int this_mod_end = 0; | 4343 | int this_mod_end = 0; |
| 4334 | int this_mod = 0; | 4344 | int this_mod = 0; |
| @@ -4375,7 +4385,7 @@ parse_modifiers_uncached (symbol, modifier_end) | |||
| 4375 | 4385 | ||
| 4376 | /* Check there is a dash after the modifier, so that it | 4386 | /* Check there is a dash after the modifier, so that it |
| 4377 | really is a modifier. */ | 4387 | really is a modifier. */ |
| 4378 | if (this_mod_end >= name->size || name->data[this_mod_end] != '-') | 4388 | if (this_mod_end >= name->size_byte || name->data[this_mod_end] != '-') |
| 4379 | break; | 4389 | break; |
| 4380 | 4390 | ||
| 4381 | /* This modifier is real; look for another. */ | 4391 | /* This modifier is real; look for another. */ |
| @@ -4386,7 +4396,7 @@ parse_modifiers_uncached (symbol, modifier_end) | |||
| 4386 | /* Should we include the `click' modifier? */ | 4396 | /* Should we include the `click' modifier? */ |
| 4387 | if (! (modifiers & (down_modifier | drag_modifier | 4397 | if (! (modifiers & (down_modifier | drag_modifier |
| 4388 | | double_modifier | triple_modifier)) | 4398 | | double_modifier | triple_modifier)) |
| 4389 | && i + 7 == name->size | 4399 | && i + 7 == name->size_byte |
| 4390 | && strncmp (name->data + i, "mouse-", 6) == 0 | 4400 | && strncmp (name->data + i, "mouse-", 6) == 0 |
| 4391 | && ('0' <= name->data[i + 6] && name->data[i + 6] <= '9')) | 4401 | && ('0' <= name->data[i + 6] && name->data[i + 6] <= '9')) |
| 4392 | modifiers |= click_modifier; | 4402 | modifiers |= click_modifier; |
| @@ -4401,16 +4411,16 @@ parse_modifiers_uncached (symbol, modifier_end) | |||
| 4401 | prepended to the string BASE[0..BASE_LEN-1]. | 4411 | prepended to the string BASE[0..BASE_LEN-1]. |
| 4402 | This doesn't use any caches. */ | 4412 | This doesn't use any caches. */ |
| 4403 | static Lisp_Object | 4413 | static Lisp_Object |
| 4404 | apply_modifiers_uncached (modifiers, base, base_len) | 4414 | apply_modifiers_uncached (modifiers, base, base_len, base_len_byte) |
| 4405 | int modifiers; | 4415 | int modifiers; |
| 4406 | char *base; | 4416 | char *base; |
| 4407 | int base_len; | 4417 | int base_len, base_len_byte; |
| 4408 | { | 4418 | { |
| 4409 | /* Since BASE could contain nulls, we can't use intern here; we have | 4419 | /* Since BASE could contain nulls, we can't use intern here; we have |
| 4410 | to use Fintern, which expects a genuine Lisp_String, and keeps a | 4420 | to use Fintern, which expects a genuine Lisp_String, and keeps a |
| 4411 | reference to it. */ | 4421 | reference to it. */ |
| 4412 | char *new_mods = | 4422 | char *new_mods |
| 4413 | (char *) alloca (sizeof ("A-C-H-M-S-s-down-drag-double-triple-")); | 4423 | = (char *) alloca (sizeof ("A-C-H-M-S-s-down-drag-double-triple-")); |
| 4414 | int mod_len; | 4424 | int mod_len; |
| 4415 | 4425 | ||
| 4416 | { | 4426 | { |
| @@ -4441,9 +4451,10 @@ apply_modifiers_uncached (modifiers, base, base_len) | |||
| 4441 | { | 4451 | { |
| 4442 | Lisp_Object new_name; | 4452 | Lisp_Object new_name; |
| 4443 | 4453 | ||
| 4444 | new_name = make_uninit_string (mod_len + base_len); | 4454 | new_name = make_uninit_multibyte_string (mod_len + base_len, |
| 4455 | mod_len + base_len_byte); | ||
| 4445 | bcopy (new_mods, XSTRING (new_name)->data, mod_len); | 4456 | bcopy (new_mods, XSTRING (new_name)->data, mod_len); |
| 4446 | bcopy (base, XSTRING (new_name)->data + mod_len, base_len); | 4457 | bcopy (base, XSTRING (new_name)->data + mod_len, base_len_byte); |
| 4447 | 4458 | ||
| 4448 | return Fintern (new_name, Qnil); | 4459 | return Fintern (new_name, Qnil); |
| 4449 | } | 4460 | } |
| @@ -4502,7 +4513,7 @@ parse_modifiers (symbol) | |||
| 4502 | Lisp_Object mask; | 4513 | Lisp_Object mask; |
| 4503 | 4514 | ||
| 4504 | unmodified = Fintern (make_string (XSYMBOL (symbol)->name->data + end, | 4515 | unmodified = Fintern (make_string (XSYMBOL (symbol)->name->data + end, |
| 4505 | XSYMBOL (symbol)->name->size - end), | 4516 | XSYMBOL (symbol)->name->size_byte - end), |
| 4506 | Qnil); | 4517 | Qnil); |
| 4507 | 4518 | ||
| 4508 | if (modifiers & ~(((EMACS_INT)1 << VALBITS) - 1)) | 4519 | if (modifiers & ~(((EMACS_INT)1 << VALBITS) - 1)) |
| @@ -4556,7 +4567,8 @@ apply_modifiers (modifiers, base) | |||
| 4556 | /* We have to create the symbol ourselves. */ | 4567 | /* We have to create the symbol ourselves. */ |
| 4557 | new_symbol = apply_modifiers_uncached (modifiers, | 4568 | new_symbol = apply_modifiers_uncached (modifiers, |
| 4558 | XSYMBOL (base)->name->data, | 4569 | XSYMBOL (base)->name->data, |
| 4559 | XSYMBOL (base)->name->size); | 4570 | XSYMBOL (base)->name->size, |
| 4571 | XSYMBOL (base)->name->size_byte); | ||
| 4560 | 4572 | ||
| 4561 | /* Add the new symbol to the base's cache. */ | 4573 | /* Add the new symbol to the base's cache. */ |
| 4562 | entry = Fcons (index, new_symbol); | 4574 | entry = Fcons (index, new_symbol); |
| @@ -4804,11 +4816,11 @@ parse_solitary_modifier (symbol) | |||
| 4804 | switch (name->data[0]) | 4816 | switch (name->data[0]) |
| 4805 | { | 4817 | { |
| 4806 | #define SINGLE_LETTER_MOD(BIT) \ | 4818 | #define SINGLE_LETTER_MOD(BIT) \ |
| 4807 | if (name->size == 1) \ | 4819 | if (name->size_byte == 1) \ |
| 4808 | return BIT; | 4820 | return BIT; |
| 4809 | 4821 | ||
| 4810 | #define MULTI_LETTER_MOD(BIT, NAME, LEN) \ | 4822 | #define MULTI_LETTER_MOD(BIT, NAME, LEN) \ |
| 4811 | if (LEN == name->size \ | 4823 | if (LEN == name->size_byte \ |
| 4812 | && ! strncmp (name->data, NAME, LEN)) \ | 4824 | && ! strncmp (name->data, NAME, LEN)) \ |
| 4813 | return BIT; | 4825 | return BIT; |
| 4814 | 4826 | ||
| @@ -5697,7 +5709,7 @@ read_char_minibuf_menu_prompt (commandflag, nmaps, maps) | |||
| 5697 | 5709 | ||
| 5698 | /* Prompt string always starts with map's prompt, and a space. */ | 5710 | /* Prompt string always starts with map's prompt, and a space. */ |
| 5699 | strcpy (menu, XSTRING (name)->data); | 5711 | strcpy (menu, XSTRING (name)->data); |
| 5700 | nlength = XSTRING (name)->size; | 5712 | nlength = XSTRING (name)->size_byte; |
| 5701 | menu[nlength++] = ':'; | 5713 | menu[nlength++] = ':'; |
| 5702 | menu[nlength++] = ' '; | 5714 | menu[nlength++] = ' '; |
| 5703 | menu[nlength] = 0; | 5715 | menu[nlength] = 0; |
| @@ -5840,7 +5852,8 @@ read_char_minibuf_menu_prompt (commandflag, nmaps, maps) | |||
| 5840 | } | 5852 | } |
| 5841 | 5853 | ||
| 5842 | /* Prompt with that and read response. */ | 5854 | /* Prompt with that and read response. */ |
| 5843 | message1 (menu); | 5855 | message2_nolog (menu, strlen (menu), |
| 5856 | ! NILP (current_buffer->enable_multibyte_characters)); | ||
| 5844 | 5857 | ||
| 5845 | /* Make believe its not a keyboard macro in case the help char | 5858 | /* Make believe its not a keyboard macro in case the help char |
| 5846 | is pressed. Help characters are not recorded because menu prompting | 5859 | is pressed. Help characters are not recorded because menu prompting |
| @@ -6884,7 +6897,7 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last, | |||
| 6884 | && ! key_translation_possible | 6897 | && ! key_translation_possible |
| 6885 | && INTEGERP (key) | 6898 | && INTEGERP (key) |
| 6886 | && ((((XINT (key) & 0x3ffff) | 6899 | && ((((XINT (key) & 0x3ffff) |
| 6887 | < XSTRING (current_buffer->downcase_table)->size) | 6900 | < XCHAR_TABLE (current_buffer->downcase_table)->size) |
| 6888 | && UPPERCASEP (XINT (key) & 0x3ffff)) | 6901 | && UPPERCASEP (XINT (key) & 0x3ffff)) |
| 6889 | || (XINT (key) & shift_modifier))) | 6902 | || (XINT (key) & shift_modifier))) |
| 6890 | { | 6903 | { |
| @@ -7222,7 +7235,6 @@ DEFUN ("execute-extended-command", Fexecute_extended_command, Sexecute_extended_ | |||
| 7222 | struct Lisp_String *str; | 7235 | struct Lisp_String *str; |
| 7223 | Lisp_Object *keys; | 7236 | Lisp_Object *keys; |
| 7224 | int i; | 7237 | int i; |
| 7225 | Lisp_Object tem; | ||
| 7226 | 7238 | ||
| 7227 | this_command_key_count = 0; | 7239 | this_command_key_count = 0; |
| 7228 | this_single_command_key_start = 0; | 7240 | this_single_command_key_start = 0; |
| @@ -7233,13 +7245,9 @@ DEFUN ("execute-extended-command", Fexecute_extended_command, Sexecute_extended_ | |||
| 7233 | 7245 | ||
| 7234 | str = XSTRING (function); | 7246 | str = XSTRING (function); |
| 7235 | for (i = 0; i < str->size; i++) | 7247 | for (i = 0; i < str->size; i++) |
| 7236 | { | 7248 | add_command_key (Faref (function, make_number (i))); |
| 7237 | XSETFASTINT (tem, str->data[i]); | ||
| 7238 | add_command_key (tem); | ||
| 7239 | } | ||
| 7240 | 7249 | ||
| 7241 | XSETFASTINT (tem, '\015'); | 7250 | add_command_key (make_number ('\015')); |
| 7242 | add_command_key (tem); | ||
| 7243 | } | 7251 | } |
| 7244 | 7252 | ||
| 7245 | UNGCPRO; | 7253 | UNGCPRO; |
| @@ -7282,12 +7290,14 @@ DEFUN ("execute-extended-command", Fexecute_extended_command, Sexecute_extended_ | |||
| 7282 | 7290 | ||
| 7283 | newmessage | 7291 | newmessage |
| 7284 | = (char *) alloca (XSYMBOL (function)->name->size | 7292 | = (char *) alloca (XSYMBOL (function)->name->size |
| 7285 | + XSTRING (binding)->size | 7293 | + XSTRING (binding)->size_byte |
| 7286 | + 100); | 7294 | + 100); |
| 7287 | sprintf (newmessage, "You can run the command `%s' with %s", | 7295 | sprintf (newmessage, "You can run the command `%s' with %s", |
| 7288 | XSYMBOL (function)->name->data, | 7296 | XSYMBOL (function)->name->data, |
| 7289 | XSTRING (binding)->data); | 7297 | XSTRING (binding)->data); |
| 7290 | message1_nolog (newmessage); | 7298 | message2_nolog (newmessage, |
| 7299 | strlen (newmessage), | ||
| 7300 | STRING_MULTIBYTE (binding)); | ||
| 7291 | if (!NILP (Fsit_for ((NUMBERP (Vsuggest_key_bindings) | 7301 | if (!NILP (Fsit_for ((NUMBERP (Vsuggest_key_bindings) |
| 7292 | ? Vsuggest_key_bindings : make_number (2)), | 7302 | ? Vsuggest_key_bindings : make_number (2)), |
| 7293 | Qnil, Qnil))) | 7303 | Qnil, Qnil))) |
| @@ -7592,7 +7602,7 @@ stuff_buffered_input (stuffstring) | |||
| 7592 | register int count; | 7602 | register int count; |
| 7593 | 7603 | ||
| 7594 | p = XSTRING (stuffstring)->data; | 7604 | p = XSTRING (stuffstring)->data; |
| 7595 | count = XSTRING (stuffstring)->size; | 7605 | count = XSTRING (stuffstring)->size_byte; |
| 7596 | while (count-- > 0) | 7606 | while (count-- > 0) |
| 7597 | stuff_char (*p++); | 7607 | stuff_char (*p++); |
| 7598 | stuff_char ('\n'); | 7608 | stuff_char ('\n'); |