summaryrefslogtreecommitdiff
path: root/src/marker.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2018-03-30 14:23:55 -0700
committerNoam Postavsky <npostavs@gmail.com>2018-06-03 12:48:13 -0400
commit51ee8bc4483d3608f4355777aeabbb31887326d9 (patch)
tree6807eeeac57c265955b8064426e39d6f4e9bdac6 /src/marker.c
parentdaa602338fd91aced720b5555c8b6ed389383831 (diff)
downloademacs-51ee8bc4483d3608f4355777aeabbb31887326d9.tar.gz
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. (cherry picked from commit 6f66a43d7ad6cada2b7dbb6d07efe36be1dc7ecb)
Diffstat (limited to 'src/marker.c')
-rw-r--r--src/marker.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/marker.c b/src/marker.c
index 7773c4fce0f..432fdd4cbfa 100644
--- a/src/marker.c
+++ b/src/marker.c
@@ -530,7 +530,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. */
@@ -539,7 +539,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
@@ -586,6 +586,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