diff options
Diffstat (limited to 'src/buffer.c')
| -rw-r--r-- | src/buffer.c | 67 |
1 files changed, 35 insertions, 32 deletions
diff --git a/src/buffer.c b/src/buffer.c index 833eb843168..8b7f524e27a 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -191,9 +191,9 @@ followed by the rest of the buffers. */) | |||
| 191 | Lisp_Object args[3]; | 191 | Lisp_Object args[3]; |
| 192 | 192 | ||
| 193 | CHECK_FRAME (frame); | 193 | CHECK_FRAME (frame); |
| 194 | framelist = Fcopy_sequence (XFRAME (frame)->buffer_list); | 194 | framelist = Fcopy_sequence (FVAR (XFRAME (frame), buffer_list)); |
| 195 | prevlist = Fnreverse (Fcopy_sequence | 195 | prevlist = Fnreverse (Fcopy_sequence |
| 196 | (XFRAME (frame)->buried_buffer_list)); | 196 | (FVAR (XFRAME (frame), buried_buffer_list))); |
| 197 | 197 | ||
| 198 | /* Remove from GENERAL any buffer that duplicates one in | 198 | /* Remove from GENERAL any buffer that duplicates one in |
| 199 | FRAMELIST or PREVLIST. */ | 199 | FRAMELIST or PREVLIST. */ |
| @@ -417,17 +417,17 @@ copy_overlays (struct buffer *b, struct Lisp_Overlay *list) | |||
| 417 | Lisp_Object overlay, start, end; | 417 | Lisp_Object overlay, start, end; |
| 418 | struct Lisp_Marker *m; | 418 | struct Lisp_Marker *m; |
| 419 | 419 | ||
| 420 | eassert (MARKERP (list->start)); | 420 | eassert (MARKERP (MVAR (list, start))); |
| 421 | m = XMARKER (list->start); | 421 | m = XMARKER (MVAR (list, start)); |
| 422 | start = build_marker (b, m->charpos, m->bytepos); | 422 | start = build_marker (b, m->charpos, m->bytepos); |
| 423 | XMARKER (start)->insertion_type = m->insertion_type; | 423 | XMARKER (start)->insertion_type = m->insertion_type; |
| 424 | 424 | ||
| 425 | eassert (MARKERP (list->end)); | 425 | eassert (MARKERP (MVAR (list, end))); |
| 426 | m = XMARKER (list->end); | 426 | m = XMARKER (MVAR (list, end)); |
| 427 | end = build_marker (b, m->charpos, m->bytepos); | 427 | end = build_marker (b, m->charpos, m->bytepos); |
| 428 | XMARKER (end)->insertion_type = m->insertion_type; | 428 | XMARKER (end)->insertion_type = m->insertion_type; |
| 429 | 429 | ||
| 430 | overlay = build_overlay (start, end, Fcopy_sequence (list->plist)); | 430 | overlay = build_overlay (start, end, Fcopy_sequence (MVAR (list, plist))); |
| 431 | if (tail) | 431 | if (tail) |
| 432 | tail = tail->next = XOVERLAY (overlay); | 432 | tail = tail->next = XOVERLAY (overlay); |
| 433 | else | 433 | else |
| @@ -657,10 +657,11 @@ CLONE nil means the indirect buffer's state is reset to default values. */) | |||
| 657 | static void | 657 | static void |
| 658 | drop_overlay (struct buffer *b, struct Lisp_Overlay *ov) | 658 | drop_overlay (struct buffer *b, struct Lisp_Overlay *ov) |
| 659 | { | 659 | { |
| 660 | eassert (b == XBUFFER (Fmarker_buffer (ov->start))); | 660 | eassert (b == XBUFFER (Fmarker_buffer (MVAR (ov, start)))); |
| 661 | modify_overlay (b, marker_position (ov->start), marker_position (ov->end)); | 661 | modify_overlay (b, marker_position (MVAR (ov, start)), |
| 662 | Fset_marker (ov->start, Qnil, Qnil); | 662 | marker_position (MVAR (ov, end))); |
| 663 | Fset_marker (ov->end, Qnil, Qnil); | 663 | Fset_marker (MVAR (ov, start), Qnil, Qnil); |
| 664 | Fset_marker (MVAR (ov, end), Qnil, Qnil); | ||
| 664 | 665 | ||
| 665 | } | 666 | } |
| 666 | 667 | ||
| @@ -1324,7 +1325,7 @@ exists, return the buffer `*scratch*' (creating it if necessary). */) | |||
| 1324 | 1325 | ||
| 1325 | pred = frame_buffer_predicate (frame); | 1326 | pred = frame_buffer_predicate (frame); |
| 1326 | /* Consider buffers that have been seen in the frame first. */ | 1327 | /* Consider buffers that have been seen in the frame first. */ |
| 1327 | tail = XFRAME (frame)->buffer_list; | 1328 | tail = FVAR (XFRAME (frame), buffer_list); |
| 1328 | for (; CONSP (tail); tail = XCDR (tail)) | 1329 | for (; CONSP (tail); tail = XCDR (tail)) |
| 1329 | { | 1330 | { |
| 1330 | buf = XCAR (tail); | 1331 | buf = XCAR (tail); |
| @@ -1446,7 +1447,7 @@ compact_buffer (struct buffer *buffer) | |||
| 1446 | 1447 | ||
| 1447 | /* Skip dead buffers, indirect buffers and buffers | 1448 | /* Skip dead buffers, indirect buffers and buffers |
| 1448 | which aren't changed since last compaction. */ | 1449 | which aren't changed since last compaction. */ |
| 1449 | if (!NILP (buffer->BUFFER_INTERNAL_FIELD (name)) | 1450 | if (!NILP (buffer->INTERNAL_FIELD (name)) |
| 1450 | && (buffer->base_buffer == NULL) | 1451 | && (buffer->base_buffer == NULL) |
| 1451 | && (buffer->text->compact != buffer->text->modiff)) | 1452 | && (buffer->text->compact != buffer->text->modiff)) |
| 1452 | { | 1453 | { |
| @@ -1454,7 +1455,7 @@ compact_buffer (struct buffer *buffer) | |||
| 1454 | turned off in that buffer. Calling truncate_undo_list on | 1455 | turned off in that buffer. Calling truncate_undo_list on |
| 1455 | Qt tends to return NULL, which effectively turns undo back on. | 1456 | Qt tends to return NULL, which effectively turns undo back on. |
| 1456 | So don't call truncate_undo_list if undo_list is Qt. */ | 1457 | So don't call truncate_undo_list if undo_list is Qt. */ |
| 1457 | if (!EQ (buffer->BUFFER_INTERNAL_FIELD (undo_list), Qt)) | 1458 | if (!EQ (buffer->INTERNAL_FIELD (undo_list), Qt)) |
| 1458 | truncate_undo_list (buffer); | 1459 | truncate_undo_list (buffer); |
| 1459 | 1460 | ||
| 1460 | /* Shrink buffer gaps. */ | 1461 | /* Shrink buffer gaps. */ |
| @@ -1557,7 +1558,7 @@ cleaning up all windows currently displaying the buffer to be killed. */) | |||
| 1557 | since anything can happen within do_yes_or_no_p. */ | 1558 | since anything can happen within do_yes_or_no_p. */ |
| 1558 | 1559 | ||
| 1559 | /* Don't kill the minibuffer now current. */ | 1560 | /* Don't kill the minibuffer now current. */ |
| 1560 | if (EQ (buffer, XWINDOW (minibuf_window)->buffer)) | 1561 | if (EQ (buffer, WVAR (XWINDOW (minibuf_window), buffer))) |
| 1561 | return Qnil; | 1562 | return Qnil; |
| 1562 | 1563 | ||
| 1563 | /* When we kill an ordinary buffer which shares it's buffer text | 1564 | /* When we kill an ordinary buffer which shares it's buffer text |
| @@ -1608,7 +1609,7 @@ cleaning up all windows currently displaying the buffer to be killed. */) | |||
| 1608 | /* If the buffer now current is shown in the minibuffer and our buffer | 1609 | /* If the buffer now current is shown in the minibuffer and our buffer |
| 1609 | is the sole other buffer give up. */ | 1610 | is the sole other buffer give up. */ |
| 1610 | XSETBUFFER (tem, current_buffer); | 1611 | XSETBUFFER (tem, current_buffer); |
| 1611 | if (EQ (tem, XWINDOW (minibuf_window)->buffer) | 1612 | if (EQ (tem, WVAR (XWINDOW (minibuf_window), buffer)) |
| 1612 | && EQ (buffer, Fother_buffer (buffer, Qnil, Qnil))) | 1613 | && EQ (buffer, Fother_buffer (buffer, Qnil, Qnil))) |
| 1613 | return Qnil; | 1614 | return Qnil; |
| 1614 | 1615 | ||
| @@ -1764,8 +1765,8 @@ record_buffer (Lisp_Object buffer) | |||
| 1764 | Vinhibit_quit = tem; | 1765 | Vinhibit_quit = tem; |
| 1765 | 1766 | ||
| 1766 | /* Update buffer list of selected frame. */ | 1767 | /* Update buffer list of selected frame. */ |
| 1767 | f->buffer_list = Fcons (buffer, Fdelq (buffer, f->buffer_list)); | 1768 | FVAR (f, buffer_list) = Fcons (buffer, Fdelq (buffer, FVAR (f, buffer_list))); |
| 1768 | f->buried_buffer_list = Fdelq (buffer, f->buried_buffer_list); | 1769 | FVAR (f, buried_buffer_list) = Fdelq (buffer, FVAR (f, buried_buffer_list)); |
| 1769 | 1770 | ||
| 1770 | /* Run buffer-list-update-hook. */ | 1771 | /* Run buffer-list-update-hook. */ |
| 1771 | if (!NILP (Vrun_hooks)) | 1772 | if (!NILP (Vrun_hooks)) |
| @@ -1802,8 +1803,9 @@ DEFUN ("bury-buffer-internal", Fbury_buffer_internal, Sbury_buffer_internal, | |||
| 1802 | Vinhibit_quit = tem; | 1803 | Vinhibit_quit = tem; |
| 1803 | 1804 | ||
| 1804 | /* Update buffer lists of selected frame. */ | 1805 | /* Update buffer lists of selected frame. */ |
| 1805 | f->buffer_list = Fdelq (buffer, f->buffer_list); | 1806 | FVAR (f, buffer_list) = Fdelq (buffer, FVAR (f, buffer_list)); |
| 1806 | f->buried_buffer_list = Fcons (buffer, Fdelq (buffer, f->buried_buffer_list)); | 1807 | FVAR (f, buried_buffer_list) |
| 1808 | = Fcons (buffer, Fdelq (buffer, FVAR (f, buried_buffer_list))); | ||
| 1807 | 1809 | ||
| 1808 | /* Run buffer-list-update-hook. */ | 1810 | /* Run buffer-list-update-hook. */ |
| 1809 | if (!NILP (Vrun_hooks)) | 1811 | if (!NILP (Vrun_hooks)) |
| @@ -2189,12 +2191,13 @@ DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text, | |||
| 2189 | while (NILP (Fmemq (w, ws))) | 2191 | while (NILP (Fmemq (w, ws))) |
| 2190 | { | 2192 | { |
| 2191 | ws = Fcons (w, ws); | 2193 | ws = Fcons (w, ws); |
| 2192 | if (MARKERP (XWINDOW (w)->pointm) | 2194 | if (MARKERP (WVAR (XWINDOW (w), pointm)) |
| 2193 | && (EQ (XWINDOW (w)->buffer, buf1) | 2195 | && (EQ (WVAR (XWINDOW (w), buffer), buf1) |
| 2194 | || EQ (XWINDOW (w)->buffer, buf2))) | 2196 | || EQ (WVAR (XWINDOW (w), buffer), buf2))) |
| 2195 | Fset_marker (XWINDOW (w)->pointm, | 2197 | Fset_marker (WVAR (XWINDOW (w), pointm), |
| 2196 | make_number (BUF_BEGV (XBUFFER (XWINDOW (w)->buffer))), | 2198 | make_number |
| 2197 | XWINDOW (w)->buffer); | 2199 | (BUF_BEGV (XBUFFER (WVAR (XWINDOW (w), buffer)))), |
| 2200 | WVAR (XWINDOW (w), buffer)); | ||
| 2198 | w = Fnext_window (w, Qt, Qt); | 2201 | w = Fnext_window (w, Qt, Qt); |
| 2199 | } | 2202 | } |
| 2200 | } | 2203 | } |
| @@ -3670,7 +3673,7 @@ modify_overlay (struct buffer *buf, ptrdiff_t start, ptrdiff_t end) | |||
| 3670 | 3673 | ||
| 3671 | /* If this is a buffer not in the selected window, | 3674 | /* If this is a buffer not in the selected window, |
| 3672 | we must do other windows. */ | 3675 | we must do other windows. */ |
| 3673 | if (buf != XBUFFER (XWINDOW (selected_window)->buffer)) | 3676 | if (buf != XBUFFER (WVAR (XWINDOW (selected_window), buffer))) |
| 3674 | windows_or_buffers_changed = 1; | 3677 | windows_or_buffers_changed = 1; |
| 3675 | /* If multiple windows show this buffer, we must do other windows. */ | 3678 | /* If multiple windows show this buffer, we must do other windows. */ |
| 3676 | else if (buffer_shared > 1) | 3679 | else if (buffer_shared > 1) |
| @@ -3884,7 +3887,7 @@ OVERLAY. */) | |||
| 3884 | { | 3887 | { |
| 3885 | CHECK_OVERLAY (overlay); | 3888 | CHECK_OVERLAY (overlay); |
| 3886 | 3889 | ||
| 3887 | return Fcopy_sequence (XOVERLAY (overlay)->plist); | 3890 | return Fcopy_sequence (MVAR (XOVERLAY (overlay), plist)); |
| 3888 | } | 3891 | } |
| 3889 | 3892 | ||
| 3890 | 3893 | ||
| @@ -4060,7 +4063,7 @@ DEFUN ("overlay-get", Foverlay_get, Soverlay_get, 2, 2, 0, | |||
| 4060 | (Lisp_Object overlay, Lisp_Object prop) | 4063 | (Lisp_Object overlay, Lisp_Object prop) |
| 4061 | { | 4064 | { |
| 4062 | CHECK_OVERLAY (overlay); | 4065 | CHECK_OVERLAY (overlay); |
| 4063 | return lookup_char_property (XOVERLAY (overlay)->plist, prop, 0); | 4066 | return lookup_char_property (MVAR (XOVERLAY (overlay), plist), prop, 0); |
| 4064 | } | 4067 | } |
| 4065 | 4068 | ||
| 4066 | DEFUN ("overlay-put", Foverlay_put, Soverlay_put, 3, 3, 0, | 4069 | DEFUN ("overlay-put", Foverlay_put, Soverlay_put, 3, 3, 0, |
| @@ -4075,7 +4078,7 @@ VALUE will be returned.*/) | |||
| 4075 | 4078 | ||
| 4076 | buffer = Fmarker_buffer (OVERLAY_START (overlay)); | 4079 | buffer = Fmarker_buffer (OVERLAY_START (overlay)); |
| 4077 | 4080 | ||
| 4078 | for (tail = XOVERLAY (overlay)->plist; | 4081 | for (tail = MVAR (XOVERLAY (overlay), plist); |
| 4079 | CONSP (tail) && CONSP (XCDR (tail)); | 4082 | CONSP (tail) && CONSP (XCDR (tail)); |
| 4080 | tail = XCDR (XCDR (tail))) | 4083 | tail = XCDR (XCDR (tail))) |
| 4081 | if (EQ (XCAR (tail), prop)) | 4084 | if (EQ (XCAR (tail), prop)) |
| @@ -4086,8 +4089,8 @@ VALUE will be returned.*/) | |||
| 4086 | } | 4089 | } |
| 4087 | /* It wasn't in the list, so add it to the front. */ | 4090 | /* It wasn't in the list, so add it to the front. */ |
| 4088 | changed = !NILP (value); | 4091 | changed = !NILP (value); |
| 4089 | XOVERLAY (overlay)->plist | 4092 | MVAR (XOVERLAY (overlay), plist) |
| 4090 | = Fcons (prop, Fcons (value, XOVERLAY (overlay)->plist)); | 4093 | = Fcons (prop, Fcons (value, MVAR (XOVERLAY (overlay), plist))); |
| 4091 | found: | 4094 | found: |
| 4092 | if (! NILP (buffer)) | 4095 | if (! NILP (buffer)) |
| 4093 | { | 4096 | { |