diff options
| author | Paul Eggert | 2018-03-30 14:23:55 -0700 |
|---|---|---|
| committer | Paul Eggert | 2018-03-30 14:26:26 -0700 |
| commit | 6f66a43d7ad6cada2b7dbb6d07efe36be1dc7ecb (patch) | |
| tree | 1a4fe997bc0d2997c3f7df516bba4331c3dccbbd /src/marker.c | |
| parent | 96b8747d5c5d747af13fd84d8fe0308ef2a0ea7a (diff) | |
| download | emacs-6f66a43d7ad6cada2b7dbb6d07efe36be1dc7ecb.tar.gz emacs-6f66a43d7ad6cada2b7dbb6d07efe36be1dc7ecb.zip | |
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.
Diffstat (limited to 'src/marker.c')
| -rw-r--r-- | src/marker.c | 13 |
1 files changed, 11 insertions, 2 deletions
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 | |||
| 560 | editing in any buffer. Returns MARKER. */) | 560 | editing in any buffer. Returns MARKER. */) |
| 561 | (Lisp_Object marker, Lisp_Object position, Lisp_Object buffer) | 561 | (Lisp_Object marker, Lisp_Object position, Lisp_Object buffer) |
| 562 | { | 562 | { |
| 563 | return set_marker_internal (marker, position, buffer, 0); | 563 | return set_marker_internal (marker, position, buffer, false); |
| 564 | } | 564 | } |
| 565 | 565 | ||
| 566 | /* Like the above, but won't let the position be outside the visible part. */ | 566 | /* Like the above, but won't let the position be outside the visible part. */ |
| @@ -569,7 +569,7 @@ Lisp_Object | |||
| 569 | set_marker_restricted (Lisp_Object marker, Lisp_Object position, | 569 | set_marker_restricted (Lisp_Object marker, Lisp_Object position, |
| 570 | Lisp_Object buffer) | 570 | Lisp_Object buffer) |
| 571 | { | 571 | { |
| 572 | return set_marker_internal (marker, position, buffer, 1); | 572 | return set_marker_internal (marker, position, buffer, true); |
| 573 | } | 573 | } |
| 574 | 574 | ||
| 575 | /* Set the position of MARKER, specifying both the | 575 | /* Set the position of MARKER, specifying both the |
| @@ -616,6 +616,15 @@ set_marker_restricted_both (Lisp_Object marker, Lisp_Object buffer, | |||
| 616 | return marker; | 616 | return marker; |
| 617 | } | 617 | } |
| 618 | 618 | ||
| 619 | /* Detach a marker so that it no longer points anywhere and no longer | ||
| 620 | slows down editing. Do not free the marker, though, as a change | ||
| 621 | function could have inserted it into an undo list (Bug#30931). */ | ||
| 622 | void | ||
| 623 | detach_marker (Lisp_Object marker) | ||
| 624 | { | ||
| 625 | Fset_marker (marker, Qnil, Qnil); | ||
| 626 | } | ||
| 627 | |||
| 619 | /* Remove MARKER from the chain of whatever buffer it is in, | 628 | /* Remove MARKER from the chain of whatever buffer it is in, |
| 620 | leaving it points to nowhere. This is called during garbage | 629 | leaving it points to nowhere. This is called during garbage |
| 621 | collection, so we must be careful to ignore and preserve | 630 | collection, so we must be careful to ignore and preserve |