413 |
reset_buffer_local_variables (b, 1); |
reset_buffer_local_variables (b, 1); |
414 |
|
|
415 |
b->mark = Fmake_marker (); |
b->mark = Fmake_marker (); |
416 |
BUF_MARKERS (b) = Qnil; |
BUF_MARKERS (b) = NULL; |
417 |
b->name = name; |
b->name = name; |
418 |
|
|
419 |
/* Put this in the alist of all live buffers. */ |
/* Put this in the alist of all live buffers. */ |
1408 |
/* Unchain all markers that belong to this indirect buffer. |
/* Unchain all markers that belong to this indirect buffer. |
1409 |
Don't unchain the markers that belong to the base buffer |
Don't unchain the markers that belong to the base buffer |
1410 |
or its other indirect buffers. */ |
or its other indirect buffers. */ |
1411 |
for (tem = BUF_MARKERS (b); !NILP (tem); ) |
for (m = BUF_MARKERS (b); m; ) |
1412 |
{ |
{ |
1413 |
Lisp_Object next; |
struct Lisp_Marker *next = m->next; |
|
m = XMARKER (tem); |
|
|
next = m->chain; |
|
1414 |
if (m->buffer == b) |
if (m->buffer == b) |
1415 |
unchain_marker (tem); |
unchain_marker (m); |
1416 |
tem = next; |
m = next; |
1417 |
} |
} |
1418 |
} |
} |
1419 |
else |
else |
1420 |
{ |
{ |
1421 |
/* Unchain all markers of this buffer and its indirect buffers. |
/* Unchain all markers of this buffer and its indirect buffers. |
1422 |
and leave them pointing nowhere. */ |
and leave them pointing nowhere. */ |
1423 |
for (tem = BUF_MARKERS (b); !NILP (tem); ) |
for (m = BUF_MARKERS (b); m; ) |
1424 |
{ |
{ |
1425 |
m = XMARKER (tem); |
struct Lisp_Marker *next = m->next; |
1426 |
m->buffer = 0; |
m->buffer = 0; |
1427 |
tem = m->chain; |
m->next = NULL; |
1428 |
m->chain = Qnil; |
m = next; |
1429 |
} |
} |
1430 |
BUF_MARKERS (b) = Qnil; |
BUF_MARKERS (b) = NULL; |
1431 |
BUF_INTERVALS (b) = NULL_INTERVAL; |
BUF_INTERVALS (b) = NULL_INTERVAL; |
1432 |
|
|
1433 |
/* Perhaps we should explicitly free the interval tree here... */ |
/* Perhaps we should explicitly free the interval tree here... */ |
1771 |
/* Look down buffer's list of local Lisp variables |
/* Look down buffer's list of local Lisp variables |
1772 |
to find and update any that forward into C variables. */ |
to find and update any that forward into C variables. */ |
1773 |
|
|
1774 |
for (tail = b->local_var_alist; !NILP (tail); tail = XCDR (tail)) |
for (tail = b->local_var_alist; CONSP (tail); tail = XCDR (tail)) |
1775 |
{ |
{ |
1776 |
valcontents = SYMBOL_VALUE (XCAR (XCAR (tail))); |
valcontents = SYMBOL_VALUE (XCAR (XCAR (tail))); |
1777 |
if ((BUFFER_LOCAL_VALUEP (valcontents) |
if ((BUFFER_LOCAL_VALUEP (valcontents) |
1786 |
/* Do the same with any others that were local to the previous buffer */ |
/* Do the same with any others that were local to the previous buffer */ |
1787 |
|
|
1788 |
if (old_buf) |
if (old_buf) |
1789 |
for (tail = old_buf->local_var_alist; !NILP (tail); tail = XCDR (tail)) |
for (tail = old_buf->local_var_alist; CONSP (tail); tail = XCDR (tail)) |
1790 |
{ |
{ |
1791 |
valcontents = SYMBOL_VALUE (XCAR (XCAR (tail))); |
valcontents = SYMBOL_VALUE (XCAR (XCAR (tail))); |
1792 |
if ((BUFFER_LOCAL_VALUEP (valcontents) |
if ((BUFFER_LOCAL_VALUEP (valcontents) |
2044 |
(flag) |
(flag) |
2045 |
Lisp_Object flag; |
Lisp_Object flag; |
2046 |
{ |
{ |
2047 |
Lisp_Object tail, markers; |
struct Lisp_Marker *tail, *markers; |
2048 |
struct buffer *other; |
struct buffer *other; |
2049 |
int undo_enabled_p = !EQ (current_buffer->undo_list, Qt); |
int undo_enabled_p = !EQ (current_buffer->undo_list, Qt); |
2050 |
int begv, zv; |
int begv, zv; |
2091 |
GPT = GPT_BYTE; |
GPT = GPT_BYTE; |
2092 |
TEMP_SET_PT_BOTH (PT_BYTE, PT_BYTE); |
TEMP_SET_PT_BOTH (PT_BYTE, PT_BYTE); |
2093 |
|
|
2094 |
tail = BUF_MARKERS (current_buffer); |
|
2095 |
while (! NILP (tail)) |
for (tail = BUF_MARKERS (current_buffer); tail; tail = tail->next) |
2096 |
{ |
tail->charpos = tail->bytepos; |
|
XMARKER (tail)->charpos = XMARKER (tail)->bytepos; |
|
|
tail = XMARKER (tail)->chain; |
|
|
} |
|
2097 |
|
|
2098 |
/* Convert multibyte form of 8-bit characters to unibyte. */ |
/* Convert multibyte form of 8-bit characters to unibyte. */ |
2099 |
pos = BEG; |
pos = BEG; |
2241 |
/* This prevents BYTE_TO_CHAR (that is, buf_bytepos_to_charpos) from |
/* This prevents BYTE_TO_CHAR (that is, buf_bytepos_to_charpos) from |
2242 |
getting confused by the markers that have not yet been updated. |
getting confused by the markers that have not yet been updated. |
2243 |
It is also a signal that it should never create a marker. */ |
It is also a signal that it should never create a marker. */ |
2244 |
BUF_MARKERS (current_buffer) = Qnil; |
BUF_MARKERS (current_buffer) = NULL; |
2245 |
|
|
2246 |
while (! NILP (tail)) |
for (; tail; tail = tail->next) |
2247 |
{ |
{ |
2248 |
XMARKER (tail)->bytepos |
tail->bytepos = advance_to_char_boundary (tail->bytepos); |
2249 |
= advance_to_char_boundary (XMARKER (tail)->bytepos); |
tail->charpos = BYTE_TO_CHAR (tail->bytepos); |
|
XMARKER (tail)->charpos = BYTE_TO_CHAR (XMARKER (tail)->bytepos); |
|
|
|
|
|
tail = XMARKER (tail)->chain; |
|
2250 |
} |
} |
2251 |
|
|
2252 |
/* Make sure no markers were put on the chain |
/* Make sure no markers were put on the chain |
2253 |
while the chain value was incorrect. */ |
while the chain value was incorrect. */ |
2254 |
if (! EQ (BUF_MARKERS (current_buffer), Qnil)) |
if (BUF_MARKERS (current_buffer)) |
2255 |
abort (); |
abort (); |
2256 |
|
|
2257 |
BUF_MARKERS (current_buffer) = markers; |
BUF_MARKERS (current_buffer) = markers; |