comparison src/cmds.c @ 12869:2304fcfade47

(Fself_insert_command): Optimize the case with arg > 2 to avoid running change hooks lots of times.
author Richard M. Stallman <rms@gnu.org>
date Wed, 16 Aug 1995 15:00:57 +0000
parents 4a83c7459b52
children 342c53de1b31
comparison
equal deleted inserted replaced
12868:8c777db02099 12869:2304fcfade47
219 CHECK_NUMBER (arg, 0); 219 CHECK_NUMBER (arg, 0);
220 220
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 {
227 /* Ok since old and new vals both nonneg */ 239 /* Ok since old and new vals both nonneg */
228 XSETFASTINT (arg, XFASTINT (arg) - 1); 240 XSETFASTINT (arg, XFASTINT (arg) - 1);
311 Vself_insert_face = Qnil; 323 Vself_insert_face = Qnil;
312 } 324 }
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;
320 } 333 }
321 return hairy; 334 return hairy;