Commit e4b6151f authored by Paul Eggert's avatar Paul Eggert

Fix integer overflow in forward-point

* lisp/subr.el (forward-point): Rewrite in Lisp and move here ...
* src/cmds.c (Fforward_point): ... from here.  This fixes an
integer overflow bug with (forward-point most-positive-fixnum).
parent d08c9472
......@@ -1558,7 +1558,6 @@ be a list of the form returned by `event-start' and `event-end'."
;;;; Obsolescent names for functions.
(make-obsolete 'forward-point "use (+ (point) N) instead." "23.1")
(make-obsolete 'buffer-has-markers-at nil "24.3")
(make-obsolete 'invocation-directory "use the variable of the same name."
......@@ -1580,6 +1579,11 @@ be a list of the form returned by `event-start' and `event-end'."
(make-obsolete 'string-as-multibyte "use `decode-coding-string'." "26.1")
(make-obsolete 'string-make-multibyte "use `decode-coding-string'." "26.1")
(defun forward-point (n)
"Return buffer position N characters after (before if N negative) point."
(declare (obsolete "use (+ (point) N) instead." "23.1"))
(+ (point) n))
(defun log10 (x)
"Return (log X 10), the log base 10 of X."
(declare (obsolete log "24.4"))
......
......@@ -31,15 +31,6 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
static int internal_self_insert (int, EMACS_INT);
DEFUN ("forward-point", Fforward_point, Sforward_point, 1, 1, 0,
doc: /* Return buffer position N characters after (before if N negative) point. */)
(Lisp_Object n)
{
CHECK_FIXNUM (n);
return make_fixnum (PT + XFIXNUM (n));
}
/* Add N to point; or subtract N if FORWARD is false. N defaults to 1.
Validate the new location. Return nil. */
static Lisp_Object
......@@ -526,7 +517,6 @@ syms_of_cmds (void)
This is run after inserting the character. */);
Vpost_self_insert_hook = Qnil;
defsubr (&Sforward_point);
defsubr (&Sforward_char);
defsubr (&Sbackward_char);
defsubr (&Sforward_line);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment