diff options
| author | Richard M. Stallman | 1995-08-16 15:00:57 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1995-08-16 15:00:57 +0000 |
| commit | 2718dfa4b84b569a7f03e42f257d984bd473fea6 (patch) | |
| tree | 59145d046e73250d3629436e9a3e76f477a72585 /src/cmds.c | |
| parent | 14a9bcda679613b9fb83521f7755c5315596e04d (diff) | |
| download | emacs-2718dfa4b84b569a7f03e42f257d984bd473fea6.tar.gz emacs-2718dfa4b84b569a7f03e42f257d984bd473fea6.zip | |
(Fself_insert_command): Optimize the case with arg > 2
to avoid running change hooks lots of times.
Diffstat (limited to 'src/cmds.c')
| -rw-r--r-- | src/cmds.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/cmds.c b/src/cmds.c index 48e89b2cabe..2a912368cb0 100644 --- a/src/cmds.c +++ b/src/cmds.c | |||
| @@ -221,6 +221,18 @@ Whichever character you type to run this command is inserted.") | |||
| 221 | /* Barf if the key that invoked this was not a character. */ | 221 | /* Barf if the key that invoked this was not a character. */ |
| 222 | if (!INTEGERP (last_command_char)) | 222 | if (!INTEGERP (last_command_char)) |
| 223 | bitch_at_user (); | 223 | bitch_at_user (); |
| 224 | else if (XINT (arg) >= 2 && NILP (current_buffer->overwrite_mode)) | ||
| 225 | { | ||
| 226 | XSETFASTINT (arg, XFASTINT (arg) - 2); | ||
| 227 | /* The first one might want to expand an abbrev. */ | ||
| 228 | internal_self_insert (XINT (last_command_char), 1); | ||
| 229 | /* The bulk of the copies of this char can be inserted simply. | ||
| 230 | We don't have to handle a user-specified face specially | ||
| 231 | because it will get inherited from the first char inserted. */ | ||
| 232 | Finsert_char (last_command_char, arg, Qt); | ||
| 233 | /* The last one might want to auto-fill. */ | ||
| 234 | internal_self_insert (XINT (last_command_char), 0); | ||
| 235 | } | ||
| 224 | else | 236 | else |
| 225 | while (XINT (arg) > 0) | 237 | while (XINT (arg) > 0) |
| 226 | { | 238 | { |
| @@ -313,7 +325,8 @@ internal_self_insert (c1, noautofill) | |||
| 313 | #endif | 325 | #endif |
| 314 | synt = SYNTAX (c); | 326 | synt = SYNTAX (c); |
| 315 | if ((synt == Sclose || synt == Smath) | 327 | if ((synt == Sclose || synt == Smath) |
| 316 | && !NILP (Vblink_paren_function) && INTERACTIVE) | 328 | && !NILP (Vblink_paren_function) && INTERACTIVE |
| 329 | && !noautofill) | ||
| 317 | { | 330 | { |
| 318 | call0 (Vblink_paren_function); | 331 | call0 (Vblink_paren_function); |
| 319 | hairy = 2; | 332 | hairy = 2; |