From 6f66a43d7ad6cada2b7dbb6d07efe36be1dc7ecb Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 30 Mar 2018 14:23:55 -0700 Subject: Centralize Bug#30931 fix * src/marker.c (detach_marker): New function. * src/editfns.c (save_restriction_restore): * src/insdel.c (signal_before_change): Use it. --- src/marker.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/marker.c') diff --git a/src/marker.c b/src/marker.c index 2a45ae636ed..2d5b05cc2b8 100644 --- a/src/marker.c +++ b/src/marker.c @@ -560,7 +560,7 @@ POSITION is nil, makes marker point nowhere so it no longer slows down editing in any buffer. Returns MARKER. */) (Lisp_Object marker, Lisp_Object position, Lisp_Object buffer) { - return set_marker_internal (marker, position, buffer, 0); + return set_marker_internal (marker, position, buffer, false); } /* Like the above, but won't let the position be outside the visible part. */ @@ -569,7 +569,7 @@ Lisp_Object set_marker_restricted (Lisp_Object marker, Lisp_Object position, Lisp_Object buffer) { - return set_marker_internal (marker, position, buffer, 1); + return set_marker_internal (marker, position, buffer, true); } /* Set the position of MARKER, specifying both the @@ -616,6 +616,15 @@ set_marker_restricted_both (Lisp_Object marker, Lisp_Object buffer, return marker; } +/* Detach a marker so that it no longer points anywhere and no longer + slows down editing. Do not free the marker, though, as a change + function could have inserted it into an undo list (Bug#30931). */ +void +detach_marker (Lisp_Object marker) +{ + Fset_marker (marker, Qnil, Qnil); +} + /* Remove MARKER from the chain of whatever buffer it is in, leaving it points to nowhere. This is called during garbage collection, so we must be careful to ignore and preserve -- cgit v1.2.3