aboutsummaryrefslogtreecommitdiffstats
path: root/src/cmds.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmds.c')
-rw-r--r--src/cmds.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/src/cmds.c b/src/cmds.c
index 5d7a45e65f6..c342cd88bd8 100644
--- a/src/cmds.c
+++ b/src/cmds.c
@@ -31,15 +31,6 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
31 31
32static int internal_self_insert (int, EMACS_INT); 32static int internal_self_insert (int, EMACS_INT);
33 33
34DEFUN ("forward-point", Fforward_point, Sforward_point, 1, 1, 0,
35 doc: /* Return buffer position N characters after (before if N negative) point. */)
36 (Lisp_Object n)
37{
38 CHECK_FIXNUM (n);
39
40 return make_fixnum (PT + XFIXNUM (n));
41}
42
43/* Add N to point; or subtract N if FORWARD is false. N defaults to 1. 34/* Add N to point; or subtract N if FORWARD is false. N defaults to 1.
44 Validate the new location. Return nil. */ 35 Validate the new location. Return nil. */
45static Lisp_Object 36static Lisp_Object
@@ -460,7 +451,10 @@ internal_self_insert (int c, EMACS_INT n)
460 string = concat2 (string, tem); 451 string = concat2 (string, tem);
461 } 452 }
462 453
463 replace_range (PT, PT + chars_to_delete, string, 1, 1, 1, 0); 454 ptrdiff_t to;
455 if (INT_ADD_WRAPV (PT, chars_to_delete, &to))
456 to = PTRDIFF_MAX;
457 replace_range (PT, to, string, 1, 1, 1, 0);
464 Fforward_char (make_fixnum (n)); 458 Fforward_char (make_fixnum (n));
465 } 459 }
466 else if (n > 1) 460 else if (n > 1)
@@ -526,7 +520,6 @@ syms_of_cmds (void)
526This is run after inserting the character. */); 520This is run after inserting the character. */);
527 Vpost_self_insert_hook = Qnil; 521 Vpost_self_insert_hook = Qnil;
528 522
529 defsubr (&Sforward_point);
530 defsubr (&Sforward_char); 523 defsubr (&Sforward_char);
531 defsubr (&Sbackward_char); 524 defsubr (&Sbackward_char);
532 defsubr (&Sforward_line); 525 defsubr (&Sforward_line);