Mercurial > emacs
changeset 22022:64ac294567a6
(unchain_marker): Abort if the marker is not in its buffer's chain.
(buf_bytepos_to_charpos): Fix assignment of `record'
when scanning from below.
Don't create a marker if buffer's marker chain is empty.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Mon, 11 May 1998 01:11:02 +0000 |
parents | 55fc60b09fa7 |
children | 8c00a2d112cc |
files | src/marker.c |
diffstat | 1 files changed, 17 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/src/marker.c Mon May 11 01:08:59 1998 +0000 +++ b/src/marker.c Mon May 11 01:11:02 1998 +0000 @@ -355,7 +355,7 @@ if (bytepos - best_below_byte < best_above_byte - bytepos) { - int record = best_above_byte - bytepos > 5000; + int record = bytepos - best_below_byte > 5000; while (best_below_byte < bytepos) { @@ -365,8 +365,10 @@ /* If this position is quite far from the nearest known position, cache the correspondence by creating a marker here. - It will last until the next GC. */ - if (record) + It will last until the next GC. + But don't do it if BUF_MARKERS is nil; + that is a signal from Fset_buffer_multibyte. */ + if (record && ! NILP (BUF_MARKERS (b))) { Lisp_Object marker, buffer; marker = Fmake_marker (); @@ -396,8 +398,10 @@ /* If this position is quite far from the nearest known position, cache the correspondence by creating a marker here. - It will last until the next GC. */ - if (record) + It will last until the next GC. + But don't do it if BUF_MARKERS is nil; + that is a signal from Fset_buffer_multibyte. */ + if (record && ! NILP (BUF_MARKERS (b))) { Lisp_Object marker, buffer; marker = Fmake_marker (); @@ -739,6 +743,8 @@ if (EQ (b->name, Qnil)) abort (); + XMARKER (marker)->buffer = 0; + tail = BUF_MARKERS (b); prev = Qnil; while (XSYMBOL (tail) != XSYMBOL (Qnil)) @@ -764,13 +770,17 @@ XMARKER (prev)->chain = next; XSETMARKBIT (XMARKER (prev)->chain, omark); } - break; + /* We have removed the marker from the chain; + no need to scan the rest of the chain. */ + return; } else prev = tail; tail = next; } - XMARKER (marker)->buffer = 0; + + /* Marker was not in its chain. */ + abort (); } /* Return the char position of marker MARKER, as a C integer. */