1 |
/* Simple built-in editing commands. |
/* Simple built-in editing commands. |
2 |
Copyright (C) 1985, 93, 94, 95, 96, 97, 1998, 2001 Free Software Foundation, Inc. |
Copyright (C) 1985, 93, 94, 95, 96, 97, 1998, 2001, 02 Free Software Foundation, Inc. |
3 |
|
|
4 |
This file is part of GNU Emacs. |
This file is part of GNU Emacs. |
5 |
|
|
42 |
Lisp_Object Vself_insert_face_command; |
Lisp_Object Vself_insert_face_command; |
43 |
|
|
44 |
extern Lisp_Object Qface; |
extern Lisp_Object Qface; |
45 |
|
extern Lisp_Object Vtranslation_table_for_input; |
46 |
|
|
47 |
DEFUN ("forward-point", Fforward_point, Sforward_point, 1, 1, 0, |
DEFUN ("forward-point", Fforward_point, Sforward_point, 1, 1, 0, |
48 |
doc: /* Return buffer position N characters after (before if N negative) point. */) |
doc: /* Return buffer position N characters after (before if N negative) point. */) |
314 |
return value; |
return value; |
315 |
} |
} |
316 |
|
|
317 |
|
/* Note that there's code in command_loop_1 which typically avoids |
318 |
|
calling this. */ |
319 |
DEFUN ("self-insert-command", Fself_insert_command, Sself_insert_command, 1, 1, "p", |
DEFUN ("self-insert-command", Fself_insert_command, Sself_insert_command, 1, 1, "p", |
320 |
doc: /* Insert the character you type. |
doc: /* Insert the character you type. |
321 |
Whichever character you type to run this command is inserted. */) |
Whichever character you type to run this command is inserted. */) |
322 |
(n) |
(n) |
323 |
Lisp_Object n; |
Lisp_Object n; |
324 |
{ |
{ |
|
int character = XINT (last_command_char); |
|
|
|
|
325 |
CHECK_NUMBER (n); |
CHECK_NUMBER (n); |
326 |
|
|
327 |
/* Barf if the key that invoked this was not a character. */ |
/* Barf if the key that invoked this was not a character. */ |
328 |
if (!INTEGERP (last_command_char)) |
if (!INTEGERP (last_command_char)) |
329 |
bitch_at_user (); |
bitch_at_user (); |
330 |
else if (XINT (n) >= 2 && NILP (current_buffer->overwrite_mode)) |
{ |
331 |
{ |
int character = translate_char (Vtranslation_table_for_input, |
332 |
int modified_char = character; |
XINT (last_command_char), 0, 0, 0); |
333 |
/* Add the offset to the character, for Finsert_char. |
if (XINT (n) >= 2 && NILP (current_buffer->overwrite_mode)) |
|
We pass internal_self_insert the unmodified character |
|
|
because it itself does this offsetting. */ |
|
|
if (! NILP (current_buffer->enable_multibyte_characters)) |
|
|
modified_char = unibyte_char_to_multibyte (modified_char); |
|
|
|
|
|
XSETFASTINT (n, XFASTINT (n) - 2); |
|
|
/* The first one might want to expand an abbrev. */ |
|
|
internal_self_insert (character, 1); |
|
|
/* The bulk of the copies of this char can be inserted simply. |
|
|
We don't have to handle a user-specified face specially |
|
|
because it will get inherited from the first char inserted. */ |
|
|
Finsert_char (make_number (modified_char), n, Qt); |
|
|
/* The last one might want to auto-fill. */ |
|
|
internal_self_insert (character, 0); |
|
|
} |
|
|
else |
|
|
while (XINT (n) > 0) |
|
334 |
{ |
{ |
335 |
/* Ok since old and new vals both nonneg */ |
int modified_char = character; |
336 |
XSETFASTINT (n, XFASTINT (n) - 1); |
/* Add the offset to the character, for Finsert_char. |
337 |
internal_self_insert (character, XFASTINT (n) != 0); |
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); |
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 |
|
} |
360 |
|
|
361 |
return Qnil; |
return Qnil; |
362 |
} |
} |