aboutsummaryrefslogtreecommitdiffstats
path: root/src/buffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c50
1 files changed, 21 insertions, 29 deletions
diff --git a/src/buffer.c b/src/buffer.c
index bb6b9fe8e56..66454c7ecc2 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -413,7 +413,7 @@ The value is never nil. */)
413 reset_buffer_local_variables (b, 1); 413 reset_buffer_local_variables (b, 1);
414 414
415 b->mark = Fmake_marker (); 415 b->mark = Fmake_marker ();
416 BUF_MARKERS (b) = Qnil; 416 BUF_MARKERS (b) = NULL;
417 b->name = name; 417 b->name = name;
418 418
419 /* Put this in the alist of all live buffers. */ 419 /* Put this in the alist of all live buffers. */
@@ -1408,28 +1408,26 @@ with SIGHUP. */)
1408 /* Unchain all markers that belong to this indirect buffer. 1408 /* Unchain all markers that belong to this indirect buffer.
1409 Don't unchain the markers that belong to the base buffer 1409 Don't unchain the markers that belong to the base buffer
1410 or its other indirect buffers. */ 1410 or its other indirect buffers. */
1411 for (tem = BUF_MARKERS (b); !NILP (tem); ) 1411 for (m = BUF_MARKERS (b); m; )
1412 { 1412 {
1413 Lisp_Object next; 1413 struct Lisp_Marker *next = m->next;
1414 m = XMARKER (tem);
1415 next = m->chain;
1416 if (m->buffer == b) 1414 if (m->buffer == b)
1417 unchain_marker (tem); 1415 unchain_marker (m);
1418 tem = next; 1416 m = next;
1419 } 1417 }
1420 } 1418 }
1421 else 1419 else
1422 { 1420 {
1423 /* Unchain all markers of this buffer and its indirect buffers. 1421 /* Unchain all markers of this buffer and its indirect buffers.
1424 and leave them pointing nowhere. */ 1422 and leave them pointing nowhere. */
1425 for (tem = BUF_MARKERS (b); !NILP (tem); ) 1423 for (m = BUF_MARKERS (b); m; )
1426 { 1424 {
1427 m = XMARKER (tem); 1425 struct Lisp_Marker *next = m->next;
1428 m->buffer = 0; 1426 m->buffer = 0;
1429 tem = m->chain; 1427 m->next = NULL;
1430 m->chain = Qnil; 1428 m = next;
1431 } 1429 }
1432 BUF_MARKERS (b) = Qnil; 1430 BUF_MARKERS (b) = NULL;
1433 BUF_INTERVALS (b) = NULL_INTERVAL; 1431 BUF_INTERVALS (b) = NULL_INTERVAL;
1434 1432
1435 /* Perhaps we should explicitly free the interval tree here... */ 1433 /* Perhaps we should explicitly free the interval tree here... */
@@ -1773,7 +1771,7 @@ set_buffer_internal_1 (b)
1773 /* Look down buffer's list of local Lisp variables 1771 /* Look down buffer's list of local Lisp variables
1774 to find and update any that forward into C variables. */ 1772 to find and update any that forward into C variables. */
1775 1773
1776 for (tail = b->local_var_alist; !NILP (tail); tail = XCDR (tail)) 1774 for (tail = b->local_var_alist; CONSP (tail); tail = XCDR (tail))
1777 { 1775 {
1778 valcontents = SYMBOL_VALUE (XCAR (XCAR (tail))); 1776 valcontents = SYMBOL_VALUE (XCAR (XCAR (tail)));
1779 if ((BUFFER_LOCAL_VALUEP (valcontents) 1777 if ((BUFFER_LOCAL_VALUEP (valcontents)
@@ -1788,7 +1786,7 @@ set_buffer_internal_1 (b)
1788 /* Do the same with any others that were local to the previous buffer */ 1786 /* Do the same with any others that were local to the previous buffer */
1789 1787
1790 if (old_buf) 1788 if (old_buf)
1791 for (tail = old_buf->local_var_alist; !NILP (tail); tail = XCDR (tail)) 1789 for (tail = old_buf->local_var_alist; CONSP (tail); tail = XCDR (tail))
1792 { 1790 {
1793 valcontents = SYMBOL_VALUE (XCAR (XCAR (tail))); 1791 valcontents = SYMBOL_VALUE (XCAR (XCAR (tail)));
1794 if ((BUFFER_LOCAL_VALUEP (valcontents) 1792 if ((BUFFER_LOCAL_VALUEP (valcontents)
@@ -2046,7 +2044,7 @@ but the contents viewed as characters do change. */)
2046 (flag) 2044 (flag)
2047 Lisp_Object flag; 2045 Lisp_Object flag;
2048{ 2046{
2049 Lisp_Object tail, markers; 2047 struct Lisp_Marker *tail, *markers;
2050 struct buffer *other; 2048 struct buffer *other;
2051 int undo_enabled_p = !EQ (current_buffer->undo_list, Qt); 2049 int undo_enabled_p = !EQ (current_buffer->undo_list, Qt);
2052 int begv, zv; 2050 int begv, zv;
@@ -2093,12 +2091,9 @@ but the contents viewed as characters do change. */)
2093 GPT = GPT_BYTE; 2091 GPT = GPT_BYTE;
2094 TEMP_SET_PT_BOTH (PT_BYTE, PT_BYTE); 2092 TEMP_SET_PT_BOTH (PT_BYTE, PT_BYTE);
2095 2093
2096 tail = BUF_MARKERS (current_buffer); 2094
2097 while (! NILP (tail)) 2095 for (tail = BUF_MARKERS (current_buffer); tail; tail = tail->next)
2098 { 2096 tail->charpos = tail->bytepos;
2099 XMARKER (tail)->charpos = XMARKER (tail)->bytepos;
2100 tail = XMARKER (tail)->chain;
2101 }
2102 2097
2103 /* Convert multibyte form of 8-bit characters to unibyte. */ 2098 /* Convert multibyte form of 8-bit characters to unibyte. */
2104 pos = BEG; 2099 pos = BEG;
@@ -2246,20 +2241,17 @@ but the contents viewed as characters do change. */)
2246 /* This prevents BYTE_TO_CHAR (that is, buf_bytepos_to_charpos) from 2241 /* This prevents BYTE_TO_CHAR (that is, buf_bytepos_to_charpos) from
2247 getting confused by the markers that have not yet been updated. 2242 getting confused by the markers that have not yet been updated.
2248 It is also a signal that it should never create a marker. */ 2243 It is also a signal that it should never create a marker. */
2249 BUF_MARKERS (current_buffer) = Qnil; 2244 BUF_MARKERS (current_buffer) = NULL;
2250 2245
2251 while (! NILP (tail)) 2246 for (; tail; tail = tail->next)
2252 { 2247 {
2253 XMARKER (tail)->bytepos 2248 tail->bytepos = advance_to_char_boundary (tail->bytepos);
2254 = advance_to_char_boundary (XMARKER (tail)->bytepos); 2249 tail->charpos = BYTE_TO_CHAR (tail->bytepos);
2255 XMARKER (tail)->charpos = BYTE_TO_CHAR (XMARKER (tail)->bytepos);
2256
2257 tail = XMARKER (tail)->chain;
2258 } 2250 }
2259 2251
2260 /* Make sure no markers were put on the chain 2252 /* Make sure no markers were put on the chain
2261 while the chain value was incorrect. */ 2253 while the chain value was incorrect. */
2262 if (! EQ (BUF_MARKERS (current_buffer), Qnil)) 2254 if (BUF_MARKERS (current_buffer))
2263 abort (); 2255 abort ();
2264 2256
2265 BUF_MARKERS (current_buffer) = markers; 2257 BUF_MARKERS (current_buffer) = markers;