# HG changeset patch # User Richard M. Stallman # Date 894849062 0 # Node ID 64ac294567a68703d46ea7d3f7246e484437e6cd # Parent 55fc60b09fa7ba822005b2dac6b0de1f1155fd78 (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. diff -r 55fc60b09fa7 -r 64ac294567a6 src/marker.c --- 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. */