diff options
| author | Dave Love | 2002-11-09 12:46:25 +0000 |
|---|---|---|
| committer | Dave Love | 2002-11-09 12:46:25 +0000 |
| commit | 867d5263229a1f56cc21c4ebd8e6ae3b5251ee03 (patch) | |
| tree | 840022c803cea444f72d323c9fa5a70681476b1a /src/cmds.c | |
| parent | 609c95d5c1ed1f310f30158a781a69ec0068cca0 (diff) | |
| download | emacs-867d5263229a1f56cc21c4ebd8e6ae3b5251ee03.tar.gz emacs-867d5263229a1f56cc21c4ebd8e6ae3b5251ee03.zip | |
(Fself_insert_command): Apply Vtranslation_table_for_input.
Diffstat (limited to 'src/cmds.c')
| -rw-r--r-- | src/cmds.c | 59 |
1 files changed, 32 insertions, 27 deletions
diff --git a/src/cmds.c b/src/cmds.c index 912c1e4a98f..61458691174 100644 --- a/src/cmds.c +++ b/src/cmds.c | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* Simple built-in editing commands. | 1 | /* Simple built-in editing commands. |
| 2 | Copyright (C) 1985, 93, 94, 95, 96, 97, 1998, 2001 Free Software Foundation, Inc. | 2 | Copyright (C) 1985, 93, 94, 95, 96, 97, 1998, 2001, 02 Free Software Foundation, Inc. |
| 3 | 3 | ||
| 4 | This file is part of GNU Emacs. | 4 | This file is part of GNU Emacs. |
| 5 | 5 | ||
| @@ -42,6 +42,7 @@ Lisp_Object Vself_insert_face; | |||
| 42 | Lisp_Object Vself_insert_face_command; | 42 | Lisp_Object Vself_insert_face_command; |
| 43 | 43 | ||
| 44 | extern Lisp_Object Qface; | 44 | extern Lisp_Object Qface; |
| 45 | extern Lisp_Object Vtranslation_table_for_input; | ||
| 45 | 46 | ||
| 46 | DEFUN ("forward-point", Fforward_point, Sforward_point, 1, 1, 0, | 47 | DEFUN ("forward-point", Fforward_point, Sforward_point, 1, 1, 0, |
| 47 | doc: /* Return buffer position N characters after (before if N negative) point. */) | 48 | doc: /* Return buffer position N characters after (before if N negative) point. */) |
| @@ -313,45 +314,49 @@ N was explicitly specified. */) | |||
| 313 | return value; | 314 | return value; |
| 314 | } | 315 | } |
| 315 | 316 | ||
| 317 | /* Note that there's code in command_loop_1 which typically avoids | ||
| 318 | calling this. */ | ||
| 316 | DEFUN ("self-insert-command", Fself_insert_command, Sself_insert_command, 1, 1, "p", | 319 | DEFUN ("self-insert-command", Fself_insert_command, Sself_insert_command, 1, 1, "p", |
| 317 | doc: /* Insert the character you type. | 320 | doc: /* Insert the character you type. |
| 318 | Whichever character you type to run this command is inserted. */) | 321 | Whichever character you type to run this command is inserted. */) |
| 319 | (n) | 322 | (n) |
| 320 | Lisp_Object n; | 323 | Lisp_Object n; |
| 321 | { | 324 | { |
| 322 | int character = XINT (last_command_char); | ||
| 323 | |||
| 324 | CHECK_NUMBER (n); | 325 | CHECK_NUMBER (n); |
| 325 | 326 | ||
| 326 | /* Barf if the key that invoked this was not a character. */ | 327 | /* Barf if the key that invoked this was not a character. */ |
| 327 | if (!INTEGERP (last_command_char)) | 328 | if (!INTEGERP (last_command_char)) |
| 328 | bitch_at_user (); | 329 | bitch_at_user (); |
| 329 | else if (XINT (n) >= 2 && NILP (current_buffer->overwrite_mode)) | 330 | { |
| 330 | { | 331 | int character = translate_char (Vtranslation_table_for_input, |
| 331 | int modified_char = character; | 332 | XINT (last_command_char), 0, 0, 0); |
| 332 | /* Add the offset to the character, for Finsert_char. | 333 | if (XINT (n) >= 2 && NILP (current_buffer->overwrite_mode)) |
| 333 | We pass internal_self_insert the unmodified character | ||
| 334 | because it itself does this offsetting. */ | ||
| 335 | if (! NILP (current_buffer->enable_multibyte_characters)) | ||
| 336 | modified_char = unibyte_char_to_multibyte (modified_char); | ||
| 337 | |||
| 338 | XSETFASTINT (n, XFASTINT (n) - 2); | ||
| 339 | /* The first one might want to expand an abbrev. */ | ||
| 340 | internal_self_insert (character, 1); | ||
| 341 | /* The bulk of the copies of this char can be inserted simply. | ||
| 342 | We don't have to handle a user-specified face specially | ||
| 343 | because it will get inherited from the first char inserted. */ | ||
| 344 | Finsert_char (make_number (modified_char), n, Qt); | ||
| 345 | /* The last one might want to auto-fill. */ | ||
| 346 | internal_self_insert (character, 0); | ||
| 347 | } | ||
| 348 | else | ||
| 349 | while (XINT (n) > 0) | ||
| 350 | { | 334 | { |
| 351 | /* Ok since old and new vals both nonneg */ | 335 | int modified_char = character; |
| 352 | XSETFASTINT (n, XFASTINT (n) - 1); | 336 | /* Add the offset to the character, for Finsert_char. |
| 353 | internal_self_insert (character, XFASTINT (n) != 0); | 337 | We pass internal_self_insert the unmodified character |
| 338 | because it itself does this offsetting. */ | ||
| 339 | if (! NILP (current_buffer->enable_multibyte_characters)) | ||
| 340 | modified_char = unibyte_char_to_multibyte (modified_char); | ||
| 341 | |||
| 342 | XSETFASTINT (n, XFASTINT (n) - 2); | ||
| 343 | /* The first one might want to expand an abbrev. */ | ||
| 344 | internal_self_insert (character, 1); | ||
| 345 | /* The bulk of the copies of this char can be inserted simply. | ||
| 346 | We don't have to handle a user-specified face specially | ||
| 347 | because it will get inherited from the first char inserted. */ | ||
| 348 | Finsert_char (make_number (modified_char), n, Qt); | ||
| 349 | /* The last one might want to auto-fill. */ | ||
| 350 | internal_self_insert (character, 0); | ||
| 354 | } | 351 | } |
| 352 | else | ||
| 353 | while (XINT (n) > 0) | ||
| 354 | { | ||
| 355 | /* Ok since old and new vals both nonneg */ | ||
| 356 | XSETFASTINT (n, XFASTINT (n) - 1); | ||
| 357 | internal_self_insert (character, XFASTINT (n) != 0); | ||
| 358 | } | ||
| 359 | } | ||
| 355 | 360 | ||
| 356 | return Qnil; | 361 | return Qnil; |
| 357 | } | 362 | } |