diff options
Diffstat (limited to 'src/window.c')
| -rw-r--r-- | src/window.c | 486 |
1 files changed, 212 insertions, 274 deletions
diff --git a/src/window.c b/src/window.c index 1784b38ba6d..b66111a5605 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -147,11 +147,6 @@ wset_display_table (struct window *w, Lisp_Object val) | |||
| 147 | w->display_table = val; | 147 | w->display_table = val; |
| 148 | } | 148 | } |
| 149 | static void | 149 | static void |
| 150 | wset_hchild (struct window *w, Lisp_Object val) | ||
| 151 | { | ||
| 152 | w->hchild = val; | ||
| 153 | } | ||
| 154 | static void | ||
| 155 | wset_left_fringe_width (struct window *w, Lisp_Object val) | 150 | wset_left_fringe_width (struct window *w, Lisp_Object val) |
| 156 | { | 151 | { |
| 157 | w->left_fringe_width = val; | 152 | w->left_fringe_width = val; |
| @@ -217,11 +212,6 @@ wset_temslot (struct window *w, Lisp_Object val) | |||
| 217 | w->temslot = val; | 212 | w->temslot = val; |
| 218 | } | 213 | } |
| 219 | static void | 214 | static void |
| 220 | wset_vchild (struct window *w, Lisp_Object val) | ||
| 221 | { | ||
| 222 | w->vchild = val; | ||
| 223 | } | ||
| 224 | static void | ||
| 225 | wset_vertical_scroll_bar_type (struct window *w, Lisp_Object val) | 215 | wset_vertical_scroll_bar_type (struct window *w, Lisp_Object val) |
| 226 | { | 216 | { |
| 227 | w->vertical_scroll_bar_type = val; | 217 | w->vertical_scroll_bar_type = val; |
| @@ -231,6 +221,18 @@ wset_window_parameters (struct window *w, Lisp_Object val) | |||
| 231 | { | 221 | { |
| 232 | w->window_parameters = val; | 222 | w->window_parameters = val; |
| 233 | } | 223 | } |
| 224 | static void | ||
| 225 | wset_combination (struct window *w, bool horflag, Lisp_Object val) | ||
| 226 | { | ||
| 227 | /* Since leaf windows never becomes non-leaf, there should | ||
| 228 | be no buffer and markers in start and pointm fields of W. */ | ||
| 229 | eassert (!BUFFERP (w->contents) && NILP (w->start) && NILP (w->pointm)); | ||
| 230 | w->contents = val; | ||
| 231 | /* When an internal window is deleted and VAL is nil, HORFLAG | ||
| 232 | is meaningless. */ | ||
| 233 | if (!NILP (val)) | ||
| 234 | w->horizontal = horflag; | ||
| 235 | } | ||
| 234 | 236 | ||
| 235 | struct window * | 237 | struct window * |
| 236 | decode_live_window (register Lisp_Object window) | 238 | decode_live_window (register Lisp_Object window) |
| @@ -275,9 +277,9 @@ static void | |||
| 275 | adjust_window_count (struct window *w, int arg) | 277 | adjust_window_count (struct window *w, int arg) |
| 276 | { | 278 | { |
| 277 | eassert (eabs (arg) == 1); | 279 | eassert (eabs (arg) == 1); |
| 278 | if (BUFFERP (w->buffer)) | 280 | if (BUFFERP (w->contents)) |
| 279 | { | 281 | { |
| 280 | struct buffer *b = XBUFFER (w->buffer); | 282 | struct buffer *b = XBUFFER (w->contents); |
| 281 | 283 | ||
| 282 | if (b->base_buffer) | 284 | if (b->base_buffer) |
| 283 | b = b->base_buffer; | 285 | b = b->base_buffer; |
| @@ -296,7 +298,11 @@ void | |||
| 296 | wset_buffer (struct window *w, Lisp_Object val) | 298 | wset_buffer (struct window *w, Lisp_Object val) |
| 297 | { | 299 | { |
| 298 | adjust_window_count (w, -1); | 300 | adjust_window_count (w, -1); |
| 299 | w->buffer = val; | 301 | if (BUFFERP (val)) |
| 302 | /* Make sure that we do not assign the buffer | ||
| 303 | to an internal window. */ | ||
| 304 | eassert (MARKERP (w->start) && MARKERP (w->pointm)); | ||
| 305 | w->contents = val; | ||
| 300 | adjust_window_count (w, 1); | 306 | adjust_window_count (w, 1); |
| 301 | } | 307 | } |
| 302 | 308 | ||
| @@ -394,15 +400,8 @@ the first window of that frame. */) | |||
| 394 | window = XFRAME (frame_or_window)->root_window; | 400 | window = XFRAME (frame_or_window)->root_window; |
| 395 | } | 401 | } |
| 396 | 402 | ||
| 397 | while (NILP (XWINDOW (window)->buffer)) | 403 | while (WINDOWP (XWINDOW (window)->contents)) |
| 398 | { | 404 | window = XWINDOW (window)->contents; |
| 399 | if (! NILP (XWINDOW (window)->hchild)) | ||
| 400 | window = XWINDOW (window)->hchild; | ||
| 401 | else if (! NILP (XWINDOW (window)->vchild)) | ||
| 402 | window = XWINDOW (window)->vchild; | ||
| 403 | else | ||
| 404 | emacs_abort (); | ||
| 405 | } | ||
| 406 | 405 | ||
| 407 | return window; | 406 | return window; |
| 408 | } | 407 | } |
| @@ -489,11 +488,11 @@ select_window (Lisp_Object window, Lisp_Object norecord, int inhibit_point_swap) | |||
| 489 | if (NILP (norecord)) | 488 | if (NILP (norecord)) |
| 490 | { | 489 | { |
| 491 | w->use_time = ++window_select_count; | 490 | w->use_time = ++window_select_count; |
| 492 | record_buffer (w->buffer); | 491 | record_buffer (w->contents); |
| 493 | } | 492 | } |
| 494 | 493 | ||
| 495 | /* Make the selected window's buffer current. */ | 494 | /* Make the selected window's buffer current. */ |
| 496 | Fset_buffer (w->buffer); | 495 | Fset_buffer (w->contents); |
| 497 | 496 | ||
| 498 | if (EQ (window, selected_window) && !inhibit_point_swap) | 497 | if (EQ (window, selected_window) && !inhibit_point_swap) |
| 499 | return window; | 498 | return window; |
| @@ -516,7 +515,7 @@ select_window (Lisp_Object window, Lisp_Object norecord, int inhibit_point_swap) | |||
| 516 | 515 | ||
| 517 | select_window_1 (window, inhibit_point_swap); | 516 | select_window_1 (window, inhibit_point_swap); |
| 518 | 517 | ||
| 519 | bset_last_selected_window (XBUFFER (w->buffer), window); | 518 | bset_last_selected_window (XBUFFER (w->contents), window); |
| 520 | windows_or_buffers_changed++; | 519 | windows_or_buffers_changed++; |
| 521 | return window; | 520 | return window; |
| 522 | } | 521 | } |
| @@ -533,10 +532,10 @@ select_window_1 (Lisp_Object window, bool inhibit_point_swap) | |||
| 533 | if (!inhibit_point_swap) | 532 | if (!inhibit_point_swap) |
| 534 | { | 533 | { |
| 535 | struct window *ow = XWINDOW (selected_window); | 534 | struct window *ow = XWINDOW (selected_window); |
| 536 | if (! NILP (ow->buffer)) | 535 | if (BUFFERP (ow->contents)) |
| 537 | set_marker_both (ow->pointm, ow->buffer, | 536 | set_marker_both (ow->pointm, ow->contents, |
| 538 | BUF_PT (XBUFFER (ow->buffer)), | 537 | BUF_PT (XBUFFER (ow->contents)), |
| 539 | BUF_PT_BYTE (XBUFFER (ow->buffer))); | 538 | BUF_PT_BYTE (XBUFFER (ow->contents))); |
| 540 | } | 539 | } |
| 541 | 540 | ||
| 542 | selected_window = window; | 541 | selected_window = window; |
| @@ -581,7 +580,8 @@ If WINDOW is omitted or nil, it defaults to the selected window. | |||
| 581 | Return nil for an internal window or a deleted window. */) | 580 | Return nil for an internal window or a deleted window. */) |
| 582 | (Lisp_Object window) | 581 | (Lisp_Object window) |
| 583 | { | 582 | { |
| 584 | return decode_any_window (window)->buffer; | 583 | struct window *w = decode_any_window (window); |
| 584 | return WINDOW_LEAF_P (w) ? w->contents : Qnil; | ||
| 585 | } | 585 | } |
| 586 | 586 | ||
| 587 | DEFUN ("window-parent", Fwindow_parent, Swindow_parent, 0, 1, 0, | 587 | DEFUN ("window-parent", Fwindow_parent, Swindow_parent, 0, 1, 0, |
| @@ -601,7 +601,8 @@ Return nil if WINDOW is an internal window whose children form a | |||
| 601 | horizontal combination. */) | 601 | horizontal combination. */) |
| 602 | (Lisp_Object window) | 602 | (Lisp_Object window) |
| 603 | { | 603 | { |
| 604 | return decode_valid_window (window)->vchild; | 604 | struct window *w = decode_valid_window (window); |
| 605 | return WINDOW_VERTICAL_COMBINATION_P (w) ? w->contents : Qnil; | ||
| 605 | } | 606 | } |
| 606 | 607 | ||
| 607 | DEFUN ("window-left-child", Fwindow_left_child, Swindow_left_child, 0, 1, 0, | 608 | DEFUN ("window-left-child", Fwindow_left_child, Swindow_left_child, 0, 1, 0, |
| @@ -612,7 +613,8 @@ Return nil if WINDOW is an internal window whose children form a | |||
| 612 | vertical combination. */) | 613 | vertical combination. */) |
| 613 | (Lisp_Object window) | 614 | (Lisp_Object window) |
| 614 | { | 615 | { |
| 615 | return decode_valid_window (window)->hchild; | 616 | struct window *w = decode_valid_window (window); |
| 617 | return WINDOW_HORIZONTAL_COMBINATION_P (w) ? w->contents : Qnil; | ||
| 616 | } | 618 | } |
| 617 | 619 | ||
| 618 | DEFUN ("window-next-sibling", Fwindow_next_sibling, Swindow_next_sibling, 0, 1, 0, | 620 | DEFUN ("window-next-sibling", Fwindow_next_sibling, Swindow_next_sibling, 0, 1, 0, |
| @@ -645,9 +647,9 @@ WINDOW are never \(re-)combined with WINDOW's siblings. */) | |||
| 645 | 647 | ||
| 646 | CHECK_VALID_WINDOW (window); | 648 | CHECK_VALID_WINDOW (window); |
| 647 | w = XWINDOW (window); | 649 | w = XWINDOW (window); |
| 648 | if (!NILP (w->buffer)) | 650 | if (WINDOW_LEAF_P (w)) |
| 649 | error ("Combination limit is meaningful for internal windows only"); | 651 | error ("Combination limit is meaningful for internal windows only"); |
| 650 | return XWINDOW (window)->combination_limit; | 652 | return w->combination_limit; |
| 651 | } | 653 | } |
| 652 | 654 | ||
| 653 | DEFUN ("set-window-combination-limit", Fset_window_combination_limit, Sset_window_combination_limit, 2, 2, 0, | 655 | DEFUN ("set-window-combination-limit", Fset_window_combination_limit, Sset_window_combination_limit, 2, 2, 0, |
| @@ -663,7 +665,7 @@ future use. */) | |||
| 663 | 665 | ||
| 664 | CHECK_VALID_WINDOW (window); | 666 | CHECK_VALID_WINDOW (window); |
| 665 | w = XWINDOW (window); | 667 | w = XWINDOW (window); |
| 666 | if (!NILP (w->buffer)) | 668 | if (WINDOW_LEAF_P (w)) |
| 667 | error ("Combination limit is meaningful for internal windows only"); | 669 | error ("Combination limit is meaningful for internal windows only"); |
| 668 | wset_combination_limit (w, limit); | 670 | wset_combination_limit (w, limit); |
| 669 | return limit; | 671 | return limit; |
| @@ -860,7 +862,7 @@ set_window_hscroll (struct window *w, EMACS_INT hscroll) | |||
| 860 | 862 | ||
| 861 | /* Prevent redisplay shortcuts when changing the hscroll. */ | 863 | /* Prevent redisplay shortcuts when changing the hscroll. */ |
| 862 | if (w->hscroll != new_hscroll) | 864 | if (w->hscroll != new_hscroll) |
| 863 | XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1; | 865 | XBUFFER (w->contents)->prevent_redisplay_optimizations_p = 1; |
| 864 | 866 | ||
| 865 | w->hscroll = new_hscroll; | 867 | w->hscroll = new_hscroll; |
| 866 | return make_number (new_hscroll); | 868 | return make_number (new_hscroll); |
| @@ -1441,7 +1443,7 @@ correct to return the top-level value of `point', outside of any | |||
| 1441 | register struct window *w = decode_live_window (window); | 1443 | register struct window *w = decode_live_window (window); |
| 1442 | 1444 | ||
| 1443 | if (w == XWINDOW (selected_window)) | 1445 | if (w == XWINDOW (selected_window)) |
| 1444 | return make_number (BUF_PT (XBUFFER (w->buffer))); | 1446 | return make_number (BUF_PT (XBUFFER (w->contents))); |
| 1445 | else | 1447 | else |
| 1446 | return Fmarker_position (w->pointm); | 1448 | return Fmarker_position (w->pointm); |
| 1447 | } | 1449 | } |
| @@ -1483,7 +1485,7 @@ if it isn't already recorded. */) | |||
| 1483 | Lisp_Object buf; | 1485 | Lisp_Object buf; |
| 1484 | struct buffer *b; | 1486 | struct buffer *b; |
| 1485 | 1487 | ||
| 1486 | buf = w->buffer; | 1488 | buf = w->contents; |
| 1487 | CHECK_BUFFER (buf); | 1489 | CHECK_BUFFER (buf); |
| 1488 | b = XBUFFER (buf); | 1490 | b = XBUFFER (buf); |
| 1489 | 1491 | ||
| @@ -1546,7 +1548,7 @@ Return POS. */) | |||
| 1546 | 1548 | ||
| 1547 | if (w == XWINDOW (selected_window)) | 1549 | if (w == XWINDOW (selected_window)) |
| 1548 | { | 1550 | { |
| 1549 | if (XBUFFER (w->buffer) == current_buffer) | 1551 | if (XBUFFER (w->contents) == current_buffer) |
| 1550 | Fgoto_char (pos); | 1552 | Fgoto_char (pos); |
| 1551 | else | 1553 | else |
| 1552 | { | 1554 | { |
| @@ -1554,14 +1556,14 @@ Return POS. */) | |||
| 1554 | 1556 | ||
| 1555 | /* ... but here we want to catch type error before buffer change. */ | 1557 | /* ... but here we want to catch type error before buffer change. */ |
| 1556 | CHECK_NUMBER_COERCE_MARKER (pos); | 1558 | CHECK_NUMBER_COERCE_MARKER (pos); |
| 1557 | set_buffer_internal (XBUFFER (w->buffer)); | 1559 | set_buffer_internal (XBUFFER (w->contents)); |
| 1558 | Fgoto_char (pos); | 1560 | Fgoto_char (pos); |
| 1559 | set_buffer_internal (old_buffer); | 1561 | set_buffer_internal (old_buffer); |
| 1560 | } | 1562 | } |
| 1561 | } | 1563 | } |
| 1562 | else | 1564 | else |
| 1563 | { | 1565 | { |
| 1564 | set_marker_restricted (w->pointm, pos, w->buffer); | 1566 | set_marker_restricted (w->pointm, pos, w->contents); |
| 1565 | /* We have to make sure that redisplay updates the window to show | 1567 | /* We have to make sure that redisplay updates the window to show |
| 1566 | the new value of point. */ | 1568 | the new value of point. */ |
| 1567 | ++windows_or_buffers_changed; | 1569 | ++windows_or_buffers_changed; |
| @@ -1579,7 +1581,7 @@ overriding motion of point in order to display at this exact start. */) | |||
| 1579 | { | 1581 | { |
| 1580 | register struct window *w = decode_live_window (window); | 1582 | register struct window *w = decode_live_window (window); |
| 1581 | 1583 | ||
| 1582 | set_marker_restricted (w->start, pos, w->buffer); | 1584 | set_marker_restricted (w->start, pos, w->contents); |
| 1583 | /* This is not right, but much easier than doing what is right. */ | 1585 | /* This is not right, but much easier than doing what is right. */ |
| 1584 | w->start_at_line_beg = 0; | 1586 | w->start_at_line_beg = 0; |
| 1585 | if (NILP (noforce)) | 1587 | if (NILP (noforce)) |
| @@ -1623,7 +1625,7 @@ display row, and VPOS is the row number (0-based) containing POS. */) | |||
| 1623 | int x, y; | 1625 | int x, y; |
| 1624 | 1626 | ||
| 1625 | w = decode_live_window (window); | 1627 | w = decode_live_window (window); |
| 1626 | buf = XBUFFER (w->buffer); | 1628 | buf = XBUFFER (w->contents); |
| 1627 | SET_TEXT_POS_FROM_MARKER (top, w->start); | 1629 | SET_TEXT_POS_FROM_MARKER (top, w->start); |
| 1628 | 1630 | ||
| 1629 | if (EQ (pos, Qt)) | 1631 | if (EQ (pos, Qt)) |
| @@ -1692,8 +1694,8 @@ Return nil if window display is not up-to-date. In that case, use | |||
| 1692 | if (noninteractive || w->pseudo_window_p) | 1694 | if (noninteractive || w->pseudo_window_p) |
| 1693 | return Qnil; | 1695 | return Qnil; |
| 1694 | 1696 | ||
| 1695 | CHECK_BUFFER (w->buffer); | 1697 | CHECK_BUFFER (w->contents); |
| 1696 | b = XBUFFER (w->buffer); | 1698 | b = XBUFFER (w->contents); |
| 1697 | 1699 | ||
| 1698 | /* Fail if current matrix is not up-to-date. */ | 1700 | /* Fail if current matrix is not up-to-date. */ |
| 1699 | if (!w->window_end_valid | 1701 | if (!w->window_end_valid |
| @@ -1919,9 +1921,9 @@ window_display_table (struct window *w) | |||
| 1919 | 1921 | ||
| 1920 | if (DISP_TABLE_P (w->display_table)) | 1922 | if (DISP_TABLE_P (w->display_table)) |
| 1921 | dp = XCHAR_TABLE (w->display_table); | 1923 | dp = XCHAR_TABLE (w->display_table); |
| 1922 | else if (BUFFERP (w->buffer)) | 1924 | else if (BUFFERP (w->contents)) |
| 1923 | { | 1925 | { |
| 1924 | struct buffer *b = XBUFFER (w->buffer); | 1926 | struct buffer *b = XBUFFER (w->contents); |
| 1925 | 1927 | ||
| 1926 | if (DISP_TABLE_P (BVAR (b, display_table))) | 1928 | if (DISP_TABLE_P (BVAR (b, display_table))) |
| 1927 | dp = XCHAR_TABLE (BVAR (b, display_table)); | 1929 | dp = XCHAR_TABLE (BVAR (b, display_table)); |
| @@ -1946,17 +1948,14 @@ WINDOW must be a live window and defaults to the selected one. */) | |||
| 1946 | static void | 1948 | static void |
| 1947 | unshow_buffer (register struct window *w) | 1949 | unshow_buffer (register struct window *w) |
| 1948 | { | 1950 | { |
| 1949 | Lisp_Object buf; | 1951 | Lisp_Object buf = w->contents; |
| 1950 | struct buffer *b; | 1952 | struct buffer *b = XBUFFER (buf); |
| 1951 | 1953 | ||
| 1952 | buf = w->buffer; | 1954 | eassert (b == XMARKER (w->pointm)->buffer); |
| 1953 | b = XBUFFER (buf); | ||
| 1954 | if (b != XMARKER (w->pointm)->buffer) | ||
| 1955 | emacs_abort (); | ||
| 1956 | 1955 | ||
| 1957 | #if 0 | 1956 | #if 0 |
| 1958 | if (w == XWINDOW (selected_window) | 1957 | if (w == XWINDOW (selected_window) |
| 1959 | || ! EQ (buf, XWINDOW (selected_window)->buffer)) | 1958 | || ! EQ (buf, XWINDOW (selected_window)->contents)) |
| 1960 | /* Do this except when the selected window's buffer | 1959 | /* Do this except when the selected window's buffer |
| 1961 | is being removed from some other window. */ | 1960 | is being removed from some other window. */ |
| 1962 | #endif | 1961 | #endif |
| @@ -1972,14 +1971,14 @@ unshow_buffer (register struct window *w) | |||
| 1972 | /* Point in the selected window's buffer | 1971 | /* Point in the selected window's buffer |
| 1973 | is actually stored in that buffer, and the window's pointm isn't used. | 1972 | is actually stored in that buffer, and the window's pointm isn't used. |
| 1974 | So don't clobber point in that buffer. */ | 1973 | So don't clobber point in that buffer. */ |
| 1975 | if (! EQ (buf, XWINDOW (selected_window)->buffer) | 1974 | if (! EQ (buf, XWINDOW (selected_window)->contents) |
| 1976 | /* Don't clobber point in current buffer either (this could be | 1975 | /* Don't clobber point in current buffer either (this could be |
| 1977 | useful in connection with bug#12208). | 1976 | useful in connection with bug#12208). |
| 1978 | && XBUFFER (buf) != current_buffer */ | 1977 | && XBUFFER (buf) != current_buffer */ |
| 1979 | /* This line helps to fix Horsley's testbug.el bug. */ | 1978 | /* This line helps to fix Horsley's testbug.el bug. */ |
| 1980 | && !(WINDOWP (BVAR (b, last_selected_window)) | 1979 | && !(WINDOWP (BVAR (b, last_selected_window)) |
| 1981 | && w != XWINDOW (BVAR (b, last_selected_window)) | 1980 | && w != XWINDOW (BVAR (b, last_selected_window)) |
| 1982 | && EQ (buf, XWINDOW (BVAR (b, last_selected_window))->buffer))) | 1981 | && EQ (buf, XWINDOW (BVAR (b, last_selected_window))->contents))) |
| 1983 | temp_set_point_both (b, | 1982 | temp_set_point_both (b, |
| 1984 | clip_to_bounds (BUF_BEGV (b), | 1983 | clip_to_bounds (BUF_BEGV (b), |
| 1985 | marker_position (w->pointm), | 1984 | marker_position (w->pointm), |
| @@ -2044,13 +2043,8 @@ replace_window (Lisp_Object old, Lisp_Object new, int setflag) | |||
| 2044 | 2043 | ||
| 2045 | tem = o->parent; | 2044 | tem = o->parent; |
| 2046 | wset_parent (n, tem); | 2045 | wset_parent (n, tem); |
| 2047 | if (!NILP (tem)) | 2046 | if (!NILP (tem) && EQ (XWINDOW (tem)->contents, old)) |
| 2048 | { | 2047 | wset_combination (XWINDOW (tem), XWINDOW (tem)->horizontal, new); |
| 2049 | if (EQ (XWINDOW (tem)->vchild, old)) | ||
| 2050 | wset_vchild (XWINDOW (tem), new); | ||
| 2051 | if (EQ (XWINDOW (tem)->hchild, old)) | ||
| 2052 | wset_hchild (XWINDOW (tem), new); | ||
| 2053 | } | ||
| 2054 | } | 2048 | } |
| 2055 | 2049 | ||
| 2056 | /* If window WINDOW and its parent window are iso-combined, merge | 2050 | /* If window WINDOW and its parent window are iso-combined, merge |
| @@ -2069,22 +2063,19 @@ recombine_windows (Lisp_Object window) | |||
| 2069 | if (!NILP (parent) && NILP (w->combination_limit)) | 2063 | if (!NILP (parent) && NILP (w->combination_limit)) |
| 2070 | { | 2064 | { |
| 2071 | p = XWINDOW (parent); | 2065 | p = XWINDOW (parent); |
| 2072 | if (((!NILP (p->vchild) && !NILP (w->vchild)) | 2066 | if (WINDOWP (p->contents) && WINDOWP (w->contents) |
| 2073 | || (!NILP (p->hchild) && !NILP (w->hchild)))) | 2067 | && p->horizontal == w->horizontal) |
| 2074 | /* WINDOW and PARENT are both either a vertical or a horizontal | 2068 | /* WINDOW and PARENT are both either a vertical or a horizontal |
| 2075 | combination. */ | 2069 | combination. */ |
| 2076 | { | 2070 | { |
| 2077 | horflag = NILP (w->vchild); | 2071 | horflag = WINDOW_HORIZONTAL_COMBINATION_P (w); |
| 2078 | child = horflag ? w->hchild : w->vchild; | 2072 | child = w->contents; |
| 2079 | c = XWINDOW (child); | 2073 | c = XWINDOW (child); |
| 2080 | 2074 | ||
| 2081 | /* Splice WINDOW's children into its parent's children and | 2075 | /* Splice WINDOW's children into its parent's children and |
| 2082 | assign new normal sizes. */ | 2076 | assign new normal sizes. */ |
| 2083 | if (NILP (w->prev)) | 2077 | if (NILP (w->prev)) |
| 2084 | if (horflag) | 2078 | wset_combination (p, horflag, child); |
| 2085 | wset_hchild (p, child); | ||
| 2086 | else | ||
| 2087 | wset_vchild (p, child); | ||
| 2088 | else | 2079 | else |
| 2089 | { | 2080 | { |
| 2090 | wset_prev (c, w->prev); | 2081 | wset_prev (c, w->prev); |
| @@ -2122,8 +2113,7 @@ recombine_windows (Lisp_Object window) | |||
| 2122 | } | 2113 | } |
| 2123 | 2114 | ||
| 2124 | /* WINDOW can be deleted now. */ | 2115 | /* WINDOW can be deleted now. */ |
| 2125 | wset_vchild (w, Qnil); | 2116 | wset_combination (w, 0, Qnil); |
| 2126 | wset_hchild (w, Qnil); | ||
| 2127 | } | 2117 | } |
| 2128 | } | 2118 | } |
| 2129 | } | 2119 | } |
| @@ -2209,7 +2199,7 @@ candidate_window_p (Lisp_Object window, Lisp_Object owindow, Lisp_Object minibuf | |||
| 2209 | struct frame *f = XFRAME (w->frame); | 2199 | struct frame *f = XFRAME (w->frame); |
| 2210 | int candidate_p = 1; | 2200 | int candidate_p = 1; |
| 2211 | 2201 | ||
| 2212 | if (!BUFFERP (w->buffer)) | 2202 | if (!BUFFERP (w->contents)) |
| 2213 | candidate_p = 0; | 2203 | candidate_p = 0; |
| 2214 | else if (MINI_WINDOW_P (w) | 2204 | else if (MINI_WINDOW_P (w) |
| 2215 | && (EQ (minibuf, Qlambda) | 2205 | && (EQ (minibuf, Qlambda) |
| @@ -2549,7 +2539,7 @@ enum window_loop | |||
| 2549 | GET_BUFFER_WINDOW, /* Arg is buffer */ | 2539 | GET_BUFFER_WINDOW, /* Arg is buffer */ |
| 2550 | REPLACE_BUFFER_IN_WINDOWS_SAFELY, /* Arg is buffer */ | 2540 | REPLACE_BUFFER_IN_WINDOWS_SAFELY, /* Arg is buffer */ |
| 2551 | REDISPLAY_BUFFER_WINDOWS, /* Arg is buffer */ | 2541 | REDISPLAY_BUFFER_WINDOWS, /* Arg is buffer */ |
| 2552 | CHECK_ALL_WINDOWS | 2542 | CHECK_ALL_WINDOWS /* Arg is ignored */ |
| 2553 | }; | 2543 | }; |
| 2554 | 2544 | ||
| 2555 | static Lisp_Object | 2545 | static Lisp_Object |
| @@ -2613,7 +2603,7 @@ window_loop (enum window_loop type, Lisp_Object obj, int mini, Lisp_Object frame | |||
| 2613 | switch (type) | 2603 | switch (type) |
| 2614 | { | 2604 | { |
| 2615 | case GET_BUFFER_WINDOW: | 2605 | case GET_BUFFER_WINDOW: |
| 2616 | if (EQ (w->buffer, obj) | 2606 | if (EQ (w->contents, obj) |
| 2617 | /* Don't find any minibuffer window except the one that | 2607 | /* Don't find any minibuffer window except the one that |
| 2618 | is currently in use. */ | 2608 | is currently in use. */ |
| 2619 | && (MINI_WINDOW_P (w) ? EQ (window, minibuf_window) : 1)) | 2609 | && (MINI_WINDOW_P (w) ? EQ (window, minibuf_window) : 1)) |
| @@ -2637,25 +2627,25 @@ window_loop (enum window_loop type, Lisp_Object obj, int mini, Lisp_Object frame | |||
| 2637 | case REPLACE_BUFFER_IN_WINDOWS_SAFELY: | 2627 | case REPLACE_BUFFER_IN_WINDOWS_SAFELY: |
| 2638 | /* We could simply check whether the buffer shown by window | 2628 | /* We could simply check whether the buffer shown by window |
| 2639 | is live, and show another buffer in case it isn't. */ | 2629 | is live, and show another buffer in case it isn't. */ |
| 2640 | if (EQ (w->buffer, obj)) | 2630 | if (EQ (w->contents, obj)) |
| 2641 | { | 2631 | { |
| 2642 | /* Undedicate WINDOW. */ | 2632 | /* Undedicate WINDOW. */ |
| 2643 | wset_dedicated (w, Qnil); | 2633 | wset_dedicated (w, Qnil); |
| 2644 | /* Make WINDOW show the buffer returned by | 2634 | /* Make WINDOW show the buffer returned by |
| 2645 | other_buffer_safely, don't run any hooks. */ | 2635 | other_buffer_safely, don't run any hooks. */ |
| 2646 | set_window_buffer | 2636 | set_window_buffer |
| 2647 | (window, other_buffer_safely (w->buffer), 0, 0); | 2637 | (window, other_buffer_safely (w->contents), 0, 0); |
| 2648 | /* If WINDOW is the selected window, make its buffer | 2638 | /* If WINDOW is the selected window, make its buffer |
| 2649 | current. But do so only if the window shows the | 2639 | current. But do so only if the window shows the |
| 2650 | current buffer (Bug#6454). */ | 2640 | current buffer (Bug#6454). */ |
| 2651 | if (EQ (window, selected_window) | 2641 | if (EQ (window, selected_window) |
| 2652 | && XBUFFER (w->buffer) == current_buffer) | 2642 | && XBUFFER (w->contents) == current_buffer) |
| 2653 | Fset_buffer (w->buffer); | 2643 | Fset_buffer (w->contents); |
| 2654 | } | 2644 | } |
| 2655 | break; | 2645 | break; |
| 2656 | 2646 | ||
| 2657 | case REDISPLAY_BUFFER_WINDOWS: | 2647 | case REDISPLAY_BUFFER_WINDOWS: |
| 2658 | if (EQ (w->buffer, obj)) | 2648 | if (EQ (w->contents, obj)) |
| 2659 | { | 2649 | { |
| 2660 | mark_window_display_accurate (window, 0); | 2650 | mark_window_display_accurate (window, 0); |
| 2661 | w->update_mode_line = 1; | 2651 | w->update_mode_line = 1; |
| @@ -2665,11 +2655,20 @@ window_loop (enum window_loop type, Lisp_Object obj, int mini, Lisp_Object frame | |||
| 2665 | } | 2655 | } |
| 2666 | break; | 2656 | break; |
| 2667 | 2657 | ||
| 2668 | /* Check for a window that has a killed buffer. */ | 2658 | /* Check for a leaf window that has a killed buffer |
| 2659 | or broken markers. */ | ||
| 2669 | case CHECK_ALL_WINDOWS: | 2660 | case CHECK_ALL_WINDOWS: |
| 2670 | if (! NILP (w->buffer) | 2661 | if (BUFFERP (w->contents)) |
| 2671 | && !BUFFER_LIVE_P (XBUFFER (w->buffer))) | 2662 | { |
| 2672 | emacs_abort (); | 2663 | struct buffer *b = XBUFFER (w->contents); |
| 2664 | |||
| 2665 | if (!BUFFER_LIVE_P (b)) | ||
| 2666 | emacs_abort (); | ||
| 2667 | if (!MARKERP (w->start) || XMARKER (w->start)->buffer != b) | ||
| 2668 | emacs_abort (); | ||
| 2669 | if (!MARKERP (w->pointm) || XMARKER (w->pointm)->buffer != b) | ||
| 2670 | emacs_abort (); | ||
| 2671 | } | ||
| 2673 | break; | 2672 | break; |
| 2674 | 2673 | ||
| 2675 | case WINDOW_LOOP_UNUSED: | 2674 | case WINDOW_LOOP_UNUSED: |
| @@ -2786,7 +2785,7 @@ window-start value is reasonable when this function is called. */) | |||
| 2786 | else if (MINI_WINDOW_P (w)) /* && top > 0) */ | 2785 | else if (MINI_WINDOW_P (w)) /* && top > 0) */ |
| 2787 | error ("Can't expand minibuffer to full frame"); | 2786 | error ("Can't expand minibuffer to full frame"); |
| 2788 | 2787 | ||
| 2789 | if (!NILP (w->buffer)) | 2788 | if (BUFFERP (w->contents)) |
| 2790 | { | 2789 | { |
| 2791 | startpos = marker_position (w->start); | 2790 | startpos = marker_position (w->start); |
| 2792 | startbyte = marker_byte_position (w->start); | 2791 | startbyte = marker_byte_position (w->start); |
| @@ -2858,7 +2857,7 @@ window-start value is reasonable when this function is called. */) | |||
| 2858 | FRAME_WINDOW_SIZES_CHANGED (f) = 1; | 2857 | FRAME_WINDOW_SIZES_CHANGED (f) = 1; |
| 2859 | resize_failed = 0; | 2858 | resize_failed = 0; |
| 2860 | 2859 | ||
| 2861 | if (NILP (w->buffer)) | 2860 | if (!WINDOW_LEAF_P (w)) |
| 2862 | { | 2861 | { |
| 2863 | /* Resize child windows vertically. */ | 2862 | /* Resize child windows vertically. */ |
| 2864 | XSETINT (delta, r->total_lines - w->total_lines); | 2863 | XSETINT (delta, r->total_lines - w->total_lines); |
| @@ -2917,28 +2916,21 @@ window-start value is reasonable when this function is called. */) | |||
| 2917 | sibling = w->next; | 2916 | sibling = w->next; |
| 2918 | s = XWINDOW (sibling); | 2917 | s = XWINDOW (sibling); |
| 2919 | wset_prev (s, Qnil); | 2918 | wset_prev (s, Qnil); |
| 2920 | if (!NILP (XWINDOW (w->parent)->vchild)) | 2919 | wset_combination (XWINDOW (w->parent), |
| 2921 | wset_vchild (XWINDOW (w->parent), sibling); | 2920 | XWINDOW (w->parent)->horizontal, sibling); |
| 2922 | else | ||
| 2923 | wset_hchild (XWINDOW (w->parent), sibling); | ||
| 2924 | } | 2921 | } |
| 2925 | 2922 | ||
| 2926 | /* Delete ROOT and all child windows of ROOT. */ | 2923 | /* Delete ROOT and all child windows of ROOT. */ |
| 2927 | if (!NILP (r->vchild)) | 2924 | if (WINDOWP (r->contents)) |
| 2928 | { | 2925 | { |
| 2929 | delete_all_child_windows (r->vchild); | 2926 | delete_all_child_windows (r->contents); |
| 2930 | wset_vchild (r, Qnil); | 2927 | wset_combination (r, 0, Qnil); |
| 2931 | } | ||
| 2932 | else if (!NILP (r->hchild)) | ||
| 2933 | { | ||
| 2934 | delete_all_child_windows (r->hchild); | ||
| 2935 | wset_hchild (r, Qnil); | ||
| 2936 | } | 2928 | } |
| 2937 | 2929 | ||
| 2938 | replace_window (root, window, 1); | 2930 | replace_window (root, window, 1); |
| 2939 | 2931 | ||
| 2940 | /* This must become SWINDOW anyway ....... */ | 2932 | /* This must become SWINDOW anyway ....... */ |
| 2941 | if (!NILP (w->buffer) && !resize_failed) | 2933 | if (BUFFERP (w->contents) && !resize_failed) |
| 2942 | { | 2934 | { |
| 2943 | /* Try to minimize scrolling, by setting the window start to the | 2935 | /* Try to minimize scrolling, by setting the window start to the |
| 2944 | point will cause the text at the old window start to be at the | 2936 | point will cause the text at the old window start to be at the |
| @@ -2947,18 +2939,18 @@ window-start value is reasonable when this function is called. */) | |||
| 2947 | when the display is not current, due to typeahead). */ | 2939 | when the display is not current, due to typeahead). */ |
| 2948 | new_top = WINDOW_TOP_EDGE_LINE (w) - FRAME_TOP_MARGIN (XFRAME (WINDOW_FRAME (w))); | 2940 | new_top = WINDOW_TOP_EDGE_LINE (w) - FRAME_TOP_MARGIN (XFRAME (WINDOW_FRAME (w))); |
| 2949 | if (new_top != top | 2941 | if (new_top != top |
| 2950 | && startpos >= BUF_BEGV (XBUFFER (w->buffer)) | 2942 | && startpos >= BUF_BEGV (XBUFFER (w->contents)) |
| 2951 | && startpos <= BUF_ZV (XBUFFER (w->buffer))) | 2943 | && startpos <= BUF_ZV (XBUFFER (w->contents))) |
| 2952 | { | 2944 | { |
| 2953 | struct position pos; | 2945 | struct position pos; |
| 2954 | struct buffer *obuf = current_buffer; | 2946 | struct buffer *obuf = current_buffer; |
| 2955 | 2947 | ||
| 2956 | Fset_buffer (w->buffer); | 2948 | Fset_buffer (w->contents); |
| 2957 | /* This computation used to temporarily move point, but that | 2949 | /* This computation used to temporarily move point, but that |
| 2958 | can have unwanted side effects due to text properties. */ | 2950 | can have unwanted side effects due to text properties. */ |
| 2959 | pos = *vmotion (startpos, startbyte, -top, w); | 2951 | pos = *vmotion (startpos, startbyte, -top, w); |
| 2960 | 2952 | ||
| 2961 | set_marker_both (w->start, w->buffer, pos.bufpos, pos.bytepos); | 2953 | set_marker_both (w->start, w->contents, pos.bufpos, pos.bytepos); |
| 2962 | w->window_end_valid = 0; | 2954 | w->window_end_valid = 0; |
| 2963 | w->start_at_line_beg = (pos.bytepos == BEGV_BYTE | 2955 | w->start_at_line_beg = (pos.bytepos == BEGV_BYTE |
| 2964 | || FETCH_BYTE (pos.bytepos - 1) == '\n'); | 2956 | || FETCH_BYTE (pos.bytepos - 1) == '\n'); |
| @@ -3158,7 +3150,7 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, | |||
| 3158 | struct window *w = XWINDOW (window); | 3150 | struct window *w = XWINDOW (window); |
| 3159 | struct buffer *b = XBUFFER (buffer); | 3151 | struct buffer *b = XBUFFER (buffer); |
| 3160 | ptrdiff_t count = SPECPDL_INDEX (); | 3152 | ptrdiff_t count = SPECPDL_INDEX (); |
| 3161 | int samebuf = EQ (buffer, w->buffer); | 3153 | int samebuf = EQ (buffer, w->contents); |
| 3162 | 3154 | ||
| 3163 | wset_buffer (w, buffer); | 3155 | wset_buffer (w, buffer); |
| 3164 | 3156 | ||
| @@ -3277,7 +3269,7 @@ This function runs `window-scroll-functions' before running | |||
| 3277 | if (!BUFFER_LIVE_P (XBUFFER (buffer))) | 3269 | if (!BUFFER_LIVE_P (XBUFFER (buffer))) |
| 3278 | error ("Attempt to display deleted buffer"); | 3270 | error ("Attempt to display deleted buffer"); |
| 3279 | 3271 | ||
| 3280 | tem = w->buffer; | 3272 | tem = w->contents; |
| 3281 | if (NILP (tem)) | 3273 | if (NILP (tem)) |
| 3282 | error ("Window is deleted"); | 3274 | error ("Window is deleted"); |
| 3283 | else | 3275 | else |
| @@ -3330,8 +3322,8 @@ displaying that buffer. */) | |||
| 3330 | struct window *w = XWINDOW (object); | 3322 | struct window *w = XWINDOW (object); |
| 3331 | mark_window_display_accurate (object, 0); | 3323 | mark_window_display_accurate (object, 0); |
| 3332 | w->update_mode_line = 1; | 3324 | w->update_mode_line = 1; |
| 3333 | if (BUFFERP (w->buffer)) | 3325 | if (BUFFERP (w->contents)) |
| 3334 | XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1; | 3326 | XBUFFER (w->contents)->prevent_redisplay_optimizations_p = 1; |
| 3335 | ++update_mode_lines; | 3327 | ++update_mode_lines; |
| 3336 | return Qt; | 3328 | return Qt; |
| 3337 | } | 3329 | } |
| @@ -3400,7 +3392,7 @@ temp_output_buffer_show (register Lisp_Object buf) | |||
| 3400 | record_unwind_protect (Fset_buffer, prev_buffer); | 3392 | record_unwind_protect (Fset_buffer, prev_buffer); |
| 3401 | record_unwind_protect (select_window_norecord, prev_window); | 3393 | record_unwind_protect (select_window_norecord, prev_window); |
| 3402 | Fselect_window (window, Qt); | 3394 | Fselect_window (window, Qt); |
| 3403 | Fset_buffer (w->buffer); | 3395 | Fset_buffer (w->contents); |
| 3404 | Frun_hooks (1, &Qtemp_buffer_show_hook); | 3396 | Frun_hooks (1, &Qtemp_buffer_show_hook); |
| 3405 | unbind_to (count, Qnil); | 3397 | unbind_to (count, Qnil); |
| 3406 | } | 3398 | } |
| @@ -3421,7 +3413,7 @@ make_parent_window (Lisp_Object window, bool horflag) | |||
| 3421 | memcpy ((char *) p + sizeof (struct vectorlike_header), | 3413 | memcpy ((char *) p + sizeof (struct vectorlike_header), |
| 3422 | (char *) o + sizeof (struct vectorlike_header), | 3414 | (char *) o + sizeof (struct vectorlike_header), |
| 3423 | word_size * VECSIZE (struct window)); | 3415 | word_size * VECSIZE (struct window)); |
| 3424 | /* P's buffer slot may change from nil to a buffer. */ | 3416 | /* P's buffer slot may change from nil to a buffer... */ |
| 3425 | adjust_window_count (p, 1); | 3417 | adjust_window_count (p, 1); |
| 3426 | XSETWINDOW (parent, p); | 3418 | XSETWINDOW (parent, p); |
| 3427 | 3419 | ||
| @@ -3430,12 +3422,11 @@ make_parent_window (Lisp_Object window, bool horflag) | |||
| 3430 | wset_next (o, Qnil); | 3422 | wset_next (o, Qnil); |
| 3431 | wset_prev (o, Qnil); | 3423 | wset_prev (o, Qnil); |
| 3432 | wset_parent (o, parent); | 3424 | wset_parent (o, parent); |
| 3433 | 3425 | /* ...but now P becomes an internal window. */ | |
| 3434 | wset_hchild (p, horflag ? window : Qnil); | ||
| 3435 | wset_vchild (p, horflag ? Qnil : window); | ||
| 3436 | wset_start (p, Qnil); | 3426 | wset_start (p, Qnil); |
| 3437 | wset_pointm (p, Qnil); | 3427 | wset_pointm (p, Qnil); |
| 3438 | wset_buffer (p, Qnil); | 3428 | wset_buffer (p, Qnil); |
| 3429 | wset_combination (p, horflag, window); | ||
| 3439 | wset_combination_limit (p, Qnil); | 3430 | wset_combination_limit (p, Qnil); |
| 3440 | wset_window_parameters (p, Qnil); | 3431 | wset_window_parameters (p, Qnil); |
| 3441 | } | 3432 | } |
| @@ -3524,10 +3515,10 @@ window_resize_check (struct window *w, bool horflag) | |||
| 3524 | { | 3515 | { |
| 3525 | struct window *c; | 3516 | struct window *c; |
| 3526 | 3517 | ||
| 3527 | if (!NILP (w->vchild)) | 3518 | if (WINDOW_VERTICAL_COMBINATION_P (w)) |
| 3528 | /* W is a vertical combination. */ | 3519 | /* W is a vertical combination. */ |
| 3529 | { | 3520 | { |
| 3530 | c = XWINDOW (w->vchild); | 3521 | c = XWINDOW (w->contents); |
| 3531 | if (horflag) | 3522 | if (horflag) |
| 3532 | /* All child windows of W must have the same width as W. */ | 3523 | /* All child windows of W must have the same width as W. */ |
| 3533 | { | 3524 | { |
| @@ -3555,10 +3546,10 @@ window_resize_check (struct window *w, bool horflag) | |||
| 3555 | return (sum_of_sizes == XINT (w->new_total)); | 3546 | return (sum_of_sizes == XINT (w->new_total)); |
| 3556 | } | 3547 | } |
| 3557 | } | 3548 | } |
| 3558 | else if (!NILP (w->hchild)) | 3549 | else if (WINDOW_HORIZONTAL_COMBINATION_P (w)) |
| 3559 | /* W is a horizontal combination. */ | 3550 | /* W is a horizontal combination. */ |
| 3560 | { | 3551 | { |
| 3561 | c = XWINDOW (w->hchild); | 3552 | c = XWINDOW (w->contents); |
| 3562 | if (horflag) | 3553 | if (horflag) |
| 3563 | /* The sum of the widths of the child windows of W must equal W's | 3554 | /* The sum of the widths of the child windows of W must equal W's |
| 3564 | width. */ | 3555 | width. */ |
| @@ -3625,10 +3616,10 @@ window_resize_apply (struct window *w, bool horflag) | |||
| 3625 | pos = w->top_line; | 3616 | pos = w->top_line; |
| 3626 | } | 3617 | } |
| 3627 | 3618 | ||
| 3628 | if (!NILP (w->vchild)) | 3619 | if (WINDOW_VERTICAL_COMBINATION_P (w)) |
| 3629 | /* W is a vertical combination. */ | 3620 | /* W is a vertical combination. */ |
| 3630 | { | 3621 | { |
| 3631 | c = XWINDOW (w->vchild); | 3622 | c = XWINDOW (w->contents); |
| 3632 | while (c) | 3623 | while (c) |
| 3633 | { | 3624 | { |
| 3634 | if (horflag) | 3625 | if (horflag) |
| @@ -3641,10 +3632,10 @@ window_resize_apply (struct window *w, bool horflag) | |||
| 3641 | c = NILP (c->next) ? 0 : XWINDOW (c->next); | 3632 | c = NILP (c->next) ? 0 : XWINDOW (c->next); |
| 3642 | } | 3633 | } |
| 3643 | } | 3634 | } |
| 3644 | else if (!NILP (w->hchild)) | 3635 | else if (WINDOW_HORIZONTAL_COMBINATION_P (w)) |
| 3645 | /* W is a horizontal combination. */ | 3636 | /* W is a horizontal combination. */ |
| 3646 | { | 3637 | { |
| 3647 | c = XWINDOW (w->hchild); | 3638 | c = XWINDOW (w->contents); |
| 3648 | while (c) | 3639 | while (c) |
| 3649 | { | 3640 | { |
| 3650 | if (horflag) | 3641 | if (horflag) |
| @@ -3727,7 +3718,7 @@ resize_frame_windows (struct frame *f, int size, bool horflag) | |||
| 3727 | ? 1 : 0))); | 3718 | ? 1 : 0))); |
| 3728 | 3719 | ||
| 3729 | r->top_line = FRAME_TOP_MARGIN (f); | 3720 | r->top_line = FRAME_TOP_MARGIN (f); |
| 3730 | if (NILP (r->vchild) && NILP (r->hchild)) | 3721 | if (WINDOW_LEAF_P (r)) |
| 3731 | /* For a leaf root window just set the size. */ | 3722 | /* For a leaf root window just set the size. */ |
| 3732 | if (horflag) | 3723 | if (horflag) |
| 3733 | r->total_cols = new_size; | 3724 | r->total_cols = new_size; |
| @@ -3842,9 +3833,9 @@ set correctly. See the code of `split-window' for how this is done. */) | |||
| 3842 | combination_limit = | 3833 | combination_limit = |
| 3843 | EQ (Vwindow_combination_limit, Qt) | 3834 | EQ (Vwindow_combination_limit, Qt) |
| 3844 | || NILP (o->parent) | 3835 | || NILP (o->parent) |
| 3845 | || NILP (horflag | 3836 | || (horflag |
| 3846 | ? (XWINDOW (o->parent)->hchild) | 3837 | ? WINDOW_VERTICAL_COMBINATION_P (XWINDOW (o->parent)) |
| 3847 | : (XWINDOW (o->parent)->vchild)); | 3838 | : WINDOW_HORIZONTAL_COMBINATION_P (XWINDOW (o->parent))); |
| 3848 | 3839 | ||
| 3849 | /* We need a live reference window to initialize some parameters. */ | 3840 | /* We need a live reference window to initialize some parameters. */ |
| 3850 | if (WINDOW_LIVE_P (old)) | 3841 | if (WINDOW_LIVE_P (old)) |
| @@ -3914,17 +3905,12 @@ set correctly. See the code of `split-window' for how this is done. */) | |||
| 3914 | n = XWINDOW (new); | 3905 | n = XWINDOW (new); |
| 3915 | wset_frame (n, frame); | 3906 | wset_frame (n, frame); |
| 3916 | wset_parent (n, o->parent); | 3907 | wset_parent (n, o->parent); |
| 3917 | wset_vchild (n, Qnil); | ||
| 3918 | wset_hchild (n, Qnil); | ||
| 3919 | 3908 | ||
| 3920 | if (EQ (side, Qabove) || EQ (side, Qleft)) | 3909 | if (EQ (side, Qabove) || EQ (side, Qleft)) |
| 3921 | { | 3910 | { |
| 3922 | wset_prev (n, o->prev); | 3911 | wset_prev (n, o->prev); |
| 3923 | if (NILP (n->prev)) | 3912 | if (NILP (n->prev)) |
| 3924 | if (horflag) | 3913 | wset_combination (p, horflag, new); |
| 3925 | wset_hchild (p, new); | ||
| 3926 | else | ||
| 3927 | wset_vchild (p, new); | ||
| 3928 | else | 3914 | else |
| 3929 | wset_next (XWINDOW (n->prev), new); | 3915 | wset_next (XWINDOW (n->prev), new); |
| 3930 | wset_next (n, old); | 3916 | wset_next (n, old); |
| @@ -3973,7 +3959,7 @@ set correctly. See the code of `split-window' for how this is done. */) | |||
| 3973 | adjust_glyphs (f); | 3959 | adjust_glyphs (f); |
| 3974 | /* Set buffer of NEW to buffer of reference window. Don't run | 3960 | /* Set buffer of NEW to buffer of reference window. Don't run |
| 3975 | any hooks. */ | 3961 | any hooks. */ |
| 3976 | set_window_buffer (new, r->buffer, 0, 1); | 3962 | set_window_buffer (new, r->contents, 0, 1); |
| 3977 | unblock_input (); | 3963 | unblock_input (); |
| 3978 | 3964 | ||
| 3979 | /* Maybe we should run the scroll functions in Elisp (which already | 3965 | /* Maybe we should run the scroll functions in Elisp (which already |
| @@ -3995,13 +3981,11 @@ Signal an error when WINDOW is the only window on its frame. */) | |||
| 3995 | register Lisp_Object parent, sibling, frame, root; | 3981 | register Lisp_Object parent, sibling, frame, root; |
| 3996 | struct window *w, *p, *s, *r; | 3982 | struct window *w, *p, *s, *r; |
| 3997 | struct frame *f; | 3983 | struct frame *f; |
| 3998 | bool horflag; | 3984 | bool horflag, before_sibling = 0; |
| 3999 | int before_sibling = 0; | ||
| 4000 | 3985 | ||
| 4001 | w = decode_any_window (window); | 3986 | w = decode_any_window (window); |
| 4002 | XSETWINDOW (window, w); | 3987 | XSETWINDOW (window, w); |
| 4003 | if (NILP (w->buffer) | 3988 | if (NILP (w->contents)) |
| 4004 | && NILP (w->hchild) && NILP (w->vchild)) | ||
| 4005 | /* It's a no-op to delete an already deleted window. */ | 3989 | /* It's a no-op to delete an already deleted window. */ |
| 4006 | return Qnil; | 3990 | return Qnil; |
| 4007 | 3991 | ||
| @@ -4015,7 +3999,7 @@ Signal an error when WINDOW is the only window on its frame. */) | |||
| 4015 | error ("Attempt to delete sole window of parent"); | 3999 | error ("Attempt to delete sole window of parent"); |
| 4016 | 4000 | ||
| 4017 | p = XWINDOW (parent); | 4001 | p = XWINDOW (parent); |
| 4018 | horflag = NILP (p->vchild); | 4002 | horflag = WINDOW_HORIZONTAL_COMBINATION_P (p); |
| 4019 | 4003 | ||
| 4020 | frame = WINDOW_FRAME (w); | 4004 | frame = WINDOW_FRAME (w); |
| 4021 | f = XFRAME (frame); | 4005 | f = XFRAME (frame); |
| @@ -4033,10 +4017,7 @@ Signal an error when WINDOW is the only window on its frame. */) | |||
| 4033 | sibling = w->next; | 4017 | sibling = w->next; |
| 4034 | s = XWINDOW (sibling); | 4018 | s = XWINDOW (sibling); |
| 4035 | wset_prev (s, Qnil); | 4019 | wset_prev (s, Qnil); |
| 4036 | if (horflag) | 4020 | wset_combination (p, horflag, sibling); |
| 4037 | wset_hchild (p, sibling); | ||
| 4038 | else | ||
| 4039 | wset_vchild (p, sibling); | ||
| 4040 | } | 4021 | } |
| 4041 | else | 4022 | else |
| 4042 | /* Get SIBLING above (on the left of) WINDOW. */ | 4023 | /* Get SIBLING above (on the left of) WINDOW. */ |
| @@ -4075,17 +4056,12 @@ Signal an error when WINDOW is the only window on its frame. */) | |||
| 4075 | wset_next (w, Qnil); /* Don't delete w->next too. */ | 4056 | wset_next (w, Qnil); /* Don't delete w->next too. */ |
| 4076 | free_window_matrices (w); | 4057 | free_window_matrices (w); |
| 4077 | 4058 | ||
| 4078 | if (!NILP (w->vchild)) | 4059 | if (WINDOWP (w->contents)) |
| 4079 | { | 4060 | { |
| 4080 | delete_all_child_windows (w->vchild); | 4061 | delete_all_child_windows (w->contents); |
| 4081 | wset_vchild (w, Qnil); | 4062 | wset_combination (w, 0, Qnil); |
| 4082 | } | 4063 | } |
| 4083 | else if (!NILP (w->hchild)) | 4064 | else |
| 4084 | { | ||
| 4085 | delete_all_child_windows (w->hchild); | ||
| 4086 | wset_hchild (w, Qnil); | ||
| 4087 | } | ||
| 4088 | else if (!NILP (w->buffer)) | ||
| 4089 | { | 4065 | { |
| 4090 | unshow_buffer (w); | 4066 | unshow_buffer (w); |
| 4091 | unchain_marker (XMARKER (w->pointm)); | 4067 | unchain_marker (XMARKER (w->pointm)); |
| @@ -4104,8 +4080,7 @@ Signal an error when WINDOW is the only window on its frame. */) | |||
| 4104 | wset_normal_cols (s, p->normal_cols); | 4080 | wset_normal_cols (s, p->normal_cols); |
| 4105 | wset_normal_lines (s, p->normal_lines); | 4081 | wset_normal_lines (s, p->normal_lines); |
| 4106 | /* Mark PARENT as deleted. */ | 4082 | /* Mark PARENT as deleted. */ |
| 4107 | wset_vchild (p, Qnil); | 4083 | wset_combination (p, 0, Qnil); |
| 4108 | wset_hchild (p, Qnil); | ||
| 4109 | /* Try to merge SIBLING into its new parent. */ | 4084 | /* Try to merge SIBLING into its new parent. */ |
| 4110 | recombine_windows (sibling); | 4085 | recombine_windows (sibling); |
| 4111 | } | 4086 | } |
| @@ -4153,10 +4128,7 @@ Signal an error when WINDOW is the only window on its frame. */) | |||
| 4153 | if (before_sibling) | 4128 | if (before_sibling) |
| 4154 | { | 4129 | { |
| 4155 | wset_prev (s, window); | 4130 | wset_prev (s, window); |
| 4156 | if (horflag) | 4131 | wset_combination (p, horflag, window); |
| 4157 | wset_hchild (p, window); | ||
| 4158 | else | ||
| 4159 | wset_vchild (p, window); | ||
| 4160 | } | 4132 | } |
| 4161 | else | 4133 | else |
| 4162 | { | 4134 | { |
| @@ -4299,10 +4271,8 @@ mark_window_cursors_off (struct window *w) | |||
| 4299 | { | 4271 | { |
| 4300 | while (w) | 4272 | while (w) |
| 4301 | { | 4273 | { |
| 4302 | if (!NILP (w->hchild)) | 4274 | if (WINDOWP (w->contents)) |
| 4303 | mark_window_cursors_off (XWINDOW (w->hchild)); | 4275 | mark_window_cursors_off (XWINDOW (w->contents)); |
| 4304 | else if (!NILP (w->vchild)) | ||
| 4305 | mark_window_cursors_off (XWINDOW (w->vchild)); | ||
| 4306 | else | 4276 | else |
| 4307 | w->phys_cursor_on_p = 0; | 4277 | w->phys_cursor_on_p = 0; |
| 4308 | 4278 | ||
| @@ -4321,8 +4291,7 @@ window_internal_height (struct window *w) | |||
| 4321 | if (!MINI_WINDOW_P (w)) | 4291 | if (!MINI_WINDOW_P (w)) |
| 4322 | { | 4292 | { |
| 4323 | if (!NILP (w->parent) | 4293 | if (!NILP (w->parent) |
| 4324 | || !NILP (w->vchild) | 4294 | || WINDOWP (w->contents) |
| 4325 | || !NILP (w->hchild) | ||
| 4326 | || !NILP (w->next) | 4295 | || !NILP (w->next) |
| 4327 | || !NILP (w->prev) | 4296 | || !NILP (w->prev) |
| 4328 | || WINDOW_WANTS_MODELINE_P (w)) | 4297 | || WINDOW_WANTS_MODELINE_P (w)) |
| @@ -4461,7 +4430,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror) | |||
| 4461 | else | 4430 | else |
| 4462 | spos = min (XINT (Fline_end_position (Qnil)) + 1, ZV); | 4431 | spos = min (XINT (Fline_end_position (Qnil)) + 1, ZV); |
| 4463 | set_marker_restricted (w->start, make_number (spos), | 4432 | set_marker_restricted (w->start, make_number (spos), |
| 4464 | w->buffer); | 4433 | w->contents); |
| 4465 | w->start_at_line_beg = 1; | 4434 | w->start_at_line_beg = 1; |
| 4466 | w->update_mode_line = 1; | 4435 | w->update_mode_line = 1; |
| 4467 | w->last_modified = 0; | 4436 | w->last_modified = 0; |
| @@ -4585,7 +4554,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror) | |||
| 4585 | 4554 | ||
| 4586 | /* If control gets here, then we vscrolled. */ | 4555 | /* If control gets here, then we vscrolled. */ |
| 4587 | 4556 | ||
| 4588 | XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1; | 4557 | XBUFFER (w->contents)->prevent_redisplay_optimizations_p = 1; |
| 4589 | 4558 | ||
| 4590 | /* Don't try to change the window start below. */ | 4559 | /* Don't try to change the window start below. */ |
| 4591 | vscrolled = 1; | 4560 | vscrolled = 1; |
| @@ -4605,7 +4574,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror) | |||
| 4605 | } | 4574 | } |
| 4606 | 4575 | ||
| 4607 | /* Set the window start, and set up the window for redisplay. */ | 4576 | /* Set the window start, and set up the window for redisplay. */ |
| 4608 | set_marker_restricted_both (w->start, w->buffer, IT_CHARPOS (it), | 4577 | set_marker_restricted_both (w->start, w->contents, IT_CHARPOS (it), |
| 4609 | IT_BYTEPOS (it)); | 4578 | IT_BYTEPOS (it)); |
| 4610 | bytepos = marker_byte_position (w->start); | 4579 | bytepos = marker_byte_position (w->start); |
| 4611 | w->start_at_line_beg = (pos == BEGV || FETCH_BYTE (bytepos - 1) == '\n'); | 4580 | w->start_at_line_beg = (pos == BEGV || FETCH_BYTE (bytepos - 1) == '\n'); |
| @@ -4805,7 +4774,7 @@ window_scroll_line_based (Lisp_Object window, int n, int whole, int noerror) | |||
| 4805 | int this_scroll_margin = | 4774 | int this_scroll_margin = |
| 4806 | max (0, min (scroll_margin, w->total_lines / 4)); | 4775 | max (0, min (scroll_margin, w->total_lines / 4)); |
| 4807 | 4776 | ||
| 4808 | set_marker_restricted_both (w->start, w->buffer, pos, pos_byte); | 4777 | set_marker_restricted_both (w->start, w->contents, pos, pos_byte); |
| 4809 | w->start_at_line_beg = !NILP (bolp); | 4778 | w->start_at_line_beg = !NILP (bolp); |
| 4810 | w->update_mode_line = 1; | 4779 | w->update_mode_line = 1; |
| 4811 | w->last_modified = 0; | 4780 | w->last_modified = 0; |
| @@ -4899,10 +4868,10 @@ scroll_command (Lisp_Object n, int direction) | |||
| 4899 | 4868 | ||
| 4900 | /* If selected window's buffer isn't current, make it current for | 4869 | /* If selected window's buffer isn't current, make it current for |
| 4901 | the moment. But don't screw up if window_scroll gets an error. */ | 4870 | the moment. But don't screw up if window_scroll gets an error. */ |
| 4902 | if (XBUFFER (XWINDOW (selected_window)->buffer) != current_buffer) | 4871 | if (XBUFFER (XWINDOW (selected_window)->contents) != current_buffer) |
| 4903 | { | 4872 | { |
| 4904 | record_unwind_protect (save_excursion_restore, save_excursion_save ()); | 4873 | record_unwind_protect (save_excursion_restore, save_excursion_save ()); |
| 4905 | Fset_buffer (XWINDOW (selected_window)->buffer); | 4874 | Fset_buffer (XWINDOW (selected_window)->contents); |
| 4906 | 4875 | ||
| 4907 | /* Make redisplay consider other windows than just selected_window. */ | 4876 | /* Make redisplay consider other windows than just selected_window. */ |
| 4908 | ++windows_or_buffers_changed; | 4877 | ++windows_or_buffers_changed; |
| @@ -5017,7 +4986,7 @@ specifies the window to scroll. This takes precedence over | |||
| 5017 | record_unwind_protect (save_excursion_restore, save_excursion_save ()); | 4986 | record_unwind_protect (save_excursion_restore, save_excursion_save ()); |
| 5018 | ++windows_or_buffers_changed; | 4987 | ++windows_or_buffers_changed; |
| 5019 | 4988 | ||
| 5020 | Fset_buffer (w->buffer); | 4989 | Fset_buffer (w->contents); |
| 5021 | SET_PT_BOTH (marker_position (w->pointm), marker_byte_position (w->pointm)); | 4990 | SET_PT_BOTH (marker_position (w->pointm), marker_byte_position (w->pointm)); |
| 5022 | 4991 | ||
| 5023 | if (NILP (arg)) | 4992 | if (NILP (arg)) |
| @@ -5111,10 +5080,10 @@ displayed_window_lines (struct window *w) | |||
| 5111 | int bottom_y; | 5080 | int bottom_y; |
| 5112 | void *itdata = NULL; | 5081 | void *itdata = NULL; |
| 5113 | 5082 | ||
| 5114 | if (XBUFFER (w->buffer) != current_buffer) | 5083 | if (XBUFFER (w->contents) != current_buffer) |
| 5115 | { | 5084 | { |
| 5116 | old_buffer = current_buffer; | 5085 | old_buffer = current_buffer; |
| 5117 | set_buffer_internal (XBUFFER (w->buffer)); | 5086 | set_buffer_internal (XBUFFER (w->contents)); |
| 5118 | } | 5087 | } |
| 5119 | else | 5088 | else |
| 5120 | old_buffer = NULL; | 5089 | old_buffer = NULL; |
| @@ -5176,7 +5145,7 @@ and redisplay normally--don't erase and redraw the frame. */) | |||
| 5176 | (register Lisp_Object arg) | 5145 | (register Lisp_Object arg) |
| 5177 | { | 5146 | { |
| 5178 | struct window *w = XWINDOW (selected_window); | 5147 | struct window *w = XWINDOW (selected_window); |
| 5179 | struct buffer *buf = XBUFFER (w->buffer); | 5148 | struct buffer *buf = XBUFFER (w->contents); |
| 5180 | struct buffer *obuf = current_buffer; | 5149 | struct buffer *obuf = current_buffer; |
| 5181 | int center_p = 0; | 5150 | int center_p = 0; |
| 5182 | ptrdiff_t charpos, bytepos; | 5151 | ptrdiff_t charpos, bytepos; |
| @@ -5342,7 +5311,7 @@ and redisplay normally--don't erase and redraw the frame. */) | |||
| 5342 | } | 5311 | } |
| 5343 | 5312 | ||
| 5344 | /* Set the new window start. */ | 5313 | /* Set the new window start. */ |
| 5345 | set_marker_both (w->start, w->buffer, charpos, bytepos); | 5314 | set_marker_both (w->start, w->contents, charpos, bytepos); |
| 5346 | w->window_end_valid = 0; | 5315 | w->window_end_valid = 0; |
| 5347 | 5316 | ||
| 5348 | w->optional_new_start = 1; | 5317 | w->optional_new_start = 1; |
| @@ -5386,9 +5355,8 @@ zero means top of window, negative means relative to bottom of window. */) | |||
| 5386 | int this_scroll_margin; | 5355 | int this_scroll_margin; |
| 5387 | #endif | 5356 | #endif |
| 5388 | 5357 | ||
| 5389 | if (!(BUFFERP (w->buffer) | 5358 | if (!(BUFFERP (w->contents) && XBUFFER (w->contents) == current_buffer)) |
| 5390 | && XBUFFER (w->buffer) == current_buffer)) | 5359 | /* This test is needed to make sure PT/PT_BYTE make sense in w->contents |
| 5391 | /* This test is needed to make sure PT/PT_BYTE make sense in w->buffer | ||
| 5392 | when passed below to set_marker_both. */ | 5360 | when passed below to set_marker_both. */ |
| 5393 | error ("move-to-window-line called from unrelated buffer"); | 5361 | error ("move-to-window-line called from unrelated buffer"); |
| 5394 | 5362 | ||
| @@ -5398,7 +5366,7 @@ zero means top of window, negative means relative to bottom of window. */) | |||
| 5398 | { | 5366 | { |
| 5399 | int height = window_internal_height (w); | 5367 | int height = window_internal_height (w); |
| 5400 | Fvertical_motion (make_number (- (height / 2)), window); | 5368 | Fvertical_motion (make_number (- (height / 2)), window); |
| 5401 | set_marker_both (w->start, w->buffer, PT, PT_BYTE); | 5369 | set_marker_both (w->start, w->contents, PT, PT_BYTE); |
| 5402 | w->start_at_line_beg = !NILP (Fbolp ()); | 5370 | w->start_at_line_beg = !NILP (Fbolp ()); |
| 5403 | w->force_start = 1; | 5371 | w->force_start = 1; |
| 5404 | } | 5372 | } |
| @@ -5548,9 +5516,9 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5548 | window-point of the final-selected-window to the window-point of | 5516 | window-point of the final-selected-window to the window-point of |
| 5549 | the current-selected-window. So we have to be careful which | 5517 | the current-selected-window. So we have to be careful which |
| 5550 | point of the current-buffer we copy into old_point. */ | 5518 | point of the current-buffer we copy into old_point. */ |
| 5551 | if (EQ (XWINDOW (data->current_window)->buffer, new_current_buffer) | 5519 | if (EQ (XWINDOW (data->current_window)->contents, new_current_buffer) |
| 5552 | && WINDOWP (selected_window) | 5520 | && WINDOWP (selected_window) |
| 5553 | && EQ (XWINDOW (selected_window)->buffer, new_current_buffer) | 5521 | && EQ (XWINDOW (selected_window)->contents, new_current_buffer) |
| 5554 | && !EQ (selected_window, data->current_window)) | 5522 | && !EQ (selected_window, data->current_window)) |
| 5555 | old_point = marker_position (XWINDOW (data->current_window)->pointm); | 5523 | old_point = marker_position (XWINDOW (data->current_window)->pointm); |
| 5556 | else | 5524 | else |
| @@ -5564,7 +5532,7 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5564 | So if possible we want this arbitrary choice of "which point" to | 5532 | So if possible we want this arbitrary choice of "which point" to |
| 5565 | be the one from the to-be-selected-window so as to prevent this | 5533 | be the one from the to-be-selected-window so as to prevent this |
| 5566 | window's cursor from being copied from another window. */ | 5534 | window's cursor from being copied from another window. */ |
| 5567 | if (EQ (XWINDOW (data->current_window)->buffer, new_current_buffer) | 5535 | if (EQ (XWINDOW (data->current_window)->contents, new_current_buffer) |
| 5568 | /* If current_window = selected_window, its point is in BUF_PT. */ | 5536 | /* If current_window = selected_window, its point is in BUF_PT. */ |
| 5569 | && !EQ (selected_window, data->current_window)) | 5537 | && !EQ (selected_window, data->current_window)) |
| 5570 | old_point = marker_position (XWINDOW (data->current_window)->pointm); | 5538 | old_point = marker_position (XWINDOW (data->current_window)->pointm); |
| @@ -5606,8 +5574,8 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5606 | p = SAVED_WINDOW_N (saved_windows, k); | 5574 | p = SAVED_WINDOW_N (saved_windows, k); |
| 5607 | window = p->window; | 5575 | window = p->window; |
| 5608 | w = XWINDOW (window); | 5576 | w = XWINDOW (window); |
| 5609 | if (!NILP (w->buffer) | 5577 | if (BUFFERP (w->contents) |
| 5610 | && !EQ (w->buffer, p->buffer) | 5578 | && !EQ (w->contents, p->buffer) |
| 5611 | && BUFFER_LIVE_P (XBUFFER (p->buffer))) | 5579 | && BUFFER_LIVE_P (XBUFFER (p->buffer))) |
| 5612 | /* If a window we restore gets another buffer, record the | 5580 | /* If a window we restore gets another buffer, record the |
| 5613 | window's old buffer. */ | 5581 | window's old buffer. */ |
| @@ -5640,13 +5608,13 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5640 | window holds garbage.) We do this now, before | 5608 | window holds garbage.) We do this now, before |
| 5641 | restoring the window contents, and prevent it from | 5609 | restoring the window contents, and prevent it from |
| 5642 | being done later on when we select a new window. */ | 5610 | being done later on when we select a new window. */ |
| 5643 | if (! NILP (XWINDOW (selected_window)->buffer)) | 5611 | if (! NILP (XWINDOW (selected_window)->contents)) |
| 5644 | { | 5612 | { |
| 5645 | w = XWINDOW (selected_window); | 5613 | w = XWINDOW (selected_window); |
| 5646 | set_marker_both (w->pointm, | 5614 | set_marker_both (w->pointm, |
| 5647 | w->buffer, | 5615 | w->contents, |
| 5648 | BUF_PT (XBUFFER (w->buffer)), | 5616 | BUF_PT (XBUFFER (w->contents)), |
| 5649 | BUF_PT_BYTE (XBUFFER (w->buffer))); | 5617 | BUF_PT_BYTE (XBUFFER (w->contents))); |
| 5650 | } | 5618 | } |
| 5651 | 5619 | ||
| 5652 | windows_or_buffers_changed++; | 5620 | windows_or_buffers_changed++; |
| @@ -5693,18 +5661,10 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5693 | { | 5661 | { |
| 5694 | wset_prev (w, Qnil); | 5662 | wset_prev (w, Qnil); |
| 5695 | if (!NILP (w->parent)) | 5663 | if (!NILP (w->parent)) |
| 5696 | { | 5664 | wset_combination (XWINDOW (w->parent), |
| 5697 | if (XINT (p->total_cols) == XWINDOW (w->parent)->total_cols) | 5665 | (XINT (p->total_cols) |
| 5698 | { | 5666 | != XWINDOW (w->parent)->total_cols), |
| 5699 | wset_vchild (XWINDOW (w->parent), p->window); | 5667 | p->window); |
| 5700 | wset_hchild (XWINDOW (w->parent), Qnil); | ||
| 5701 | } | ||
| 5702 | else | ||
| 5703 | { | ||
| 5704 | wset_hchild (XWINDOW (w->parent), p->window); | ||
| 5705 | wset_vchild (XWINDOW (w->parent), Qnil); | ||
| 5706 | } | ||
| 5707 | } | ||
| 5708 | } | 5668 | } |
| 5709 | 5669 | ||
| 5710 | /* If we squirreled away the buffer, restore it now. */ | 5670 | /* If we squirreled away the buffer, restore it now. */ |
| @@ -5753,20 +5713,16 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5753 | w->last_modified = 0; | 5713 | w->last_modified = 0; |
| 5754 | w->last_overlay_modified = 0; | 5714 | w->last_overlay_modified = 0; |
| 5755 | 5715 | ||
| 5756 | /* Reinstall the saved buffer and pointers into it. */ | 5716 | if (BUFFERP (p->buffer) && BUFFER_LIVE_P (XBUFFER (p->buffer))) |
| 5757 | if (NILP (p->buffer)) | ||
| 5758 | /* An internal window. */ | ||
| 5759 | wset_buffer (w, p->buffer); | ||
| 5760 | else if (BUFFER_LIVE_P (XBUFFER (p->buffer))) | ||
| 5761 | /* If saved buffer is alive, install it. */ | 5717 | /* If saved buffer is alive, install it. */ |
| 5762 | { | 5718 | { |
| 5763 | wset_buffer (w, p->buffer); | 5719 | wset_buffer (w, p->buffer); |
| 5764 | w->start_at_line_beg = !NILP (p->start_at_line_beg); | 5720 | w->start_at_line_beg = !NILP (p->start_at_line_beg); |
| 5765 | set_marker_restricted (w->start, p->start, w->buffer); | 5721 | set_marker_restricted (w->start, p->start, w->contents); |
| 5766 | set_marker_restricted (w->pointm, p->pointm, | 5722 | set_marker_restricted (w->pointm, p->pointm, |
| 5767 | w->buffer); | 5723 | w->contents); |
| 5768 | Fset_marker (BVAR (XBUFFER (w->buffer), mark), | 5724 | Fset_marker (BVAR (XBUFFER (w->contents), mark), |
| 5769 | p->mark, w->buffer); | 5725 | p->mark, w->contents); |
| 5770 | 5726 | ||
| 5771 | /* As documented in Fcurrent_window_configuration, don't | 5727 | /* As documented in Fcurrent_window_configuration, don't |
| 5772 | restore the location of point in the buffer which was | 5728 | restore the location of point in the buffer which was |
| @@ -5775,23 +5731,21 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5775 | && XBUFFER (p->buffer) == current_buffer) | 5731 | && XBUFFER (p->buffer) == current_buffer) |
| 5776 | Fgoto_char (w->pointm); | 5732 | Fgoto_char (w->pointm); |
| 5777 | } | 5733 | } |
| 5778 | else if (!NILP (w->buffer) | 5734 | else if (BUFFERP (w->contents) && BUFFER_LIVE_P (XBUFFER (w->contents))) |
| 5779 | && BUFFER_LIVE_P (XBUFFER (w->buffer))) | 5735 | /* Keep window's old buffer; make sure the markers are real. */ |
| 5780 | /* Keep window's old buffer; make sure the markers are | 5736 | { |
| 5781 | real. */ | 5737 | /* Set window markers at start of visible range. */ |
| 5782 | { | 5738 | if (XMARKER (w->start)->buffer == 0) |
| 5783 | /* Set window markers at start of visible range. */ | 5739 | set_marker_restricted_both (w->start, w->contents, 0, 0); |
| 5784 | if (XMARKER (w->start)->buffer == 0) | 5740 | if (XMARKER (w->pointm)->buffer == 0) |
| 5785 | set_marker_restricted_both (w->start, w->buffer, 0, 0); | 5741 | set_marker_restricted_both |
| 5786 | if (XMARKER (w->pointm)->buffer == 0) | 5742 | (w->pointm, w->contents, |
| 5787 | set_marker_restricted_both | 5743 | BUF_PT (XBUFFER (w->contents)), |
| 5788 | (w->pointm, w->buffer, | 5744 | BUF_PT_BYTE (XBUFFER (w->contents))); |
| 5789 | BUF_PT (XBUFFER (w->buffer)), | 5745 | w->start_at_line_beg = 1; |
| 5790 | BUF_PT_BYTE (XBUFFER (w->buffer))); | 5746 | } |
| 5791 | w->start_at_line_beg = 1; | 5747 | else if (!NILP (w->start)) |
| 5792 | } | 5748 | /* Leaf window has no live buffer, get one. */ |
| 5793 | else | ||
| 5794 | /* Window has no live buffer, get one. */ | ||
| 5795 | { | 5749 | { |
| 5796 | /* Get the buffer via other_buffer_safely in order to | 5750 | /* Get the buffer via other_buffer_safely in order to |
| 5797 | avoid showing an unimportant buffer and, if necessary, to | 5751 | avoid showing an unimportant buffer and, if necessary, to |
| @@ -5800,8 +5754,8 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5800 | wset_buffer (w, other_buffer_safely (Fcurrent_buffer ())); | 5754 | wset_buffer (w, other_buffer_safely (Fcurrent_buffer ())); |
| 5801 | /* This will set the markers to beginning of visible | 5755 | /* This will set the markers to beginning of visible |
| 5802 | range. */ | 5756 | range. */ |
| 5803 | set_marker_restricted_both (w->start, w->buffer, 0, 0); | 5757 | set_marker_restricted_both (w->start, w->contents, 0, 0); |
| 5804 | set_marker_restricted_both (w->pointm, w->buffer, 0, 0); | 5758 | set_marker_restricted_both (w->pointm, w->contents, 0, 0); |
| 5805 | w->start_at_line_beg = 1; | 5759 | w->start_at_line_beg = 1; |
| 5806 | if (!NILP (w->dedicated)) | 5760 | if (!NILP (w->dedicated)) |
| 5807 | /* Record this window as dead. */ | 5761 | /* Record this window as dead. */ |
| @@ -5814,17 +5768,17 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5814 | fset_root_window (f, data->root_window); | 5768 | fset_root_window (f, data->root_window); |
| 5815 | /* Arrange *not* to restore point in the buffer that was | 5769 | /* Arrange *not* to restore point in the buffer that was |
| 5816 | current when the window configuration was saved. */ | 5770 | current when the window configuration was saved. */ |
| 5817 | if (EQ (XWINDOW (data->current_window)->buffer, new_current_buffer)) | 5771 | if (EQ (XWINDOW (data->current_window)->contents, new_current_buffer)) |
| 5818 | set_marker_restricted (XWINDOW (data->current_window)->pointm, | 5772 | set_marker_restricted (XWINDOW (data->current_window)->pointm, |
| 5819 | make_number (old_point), | 5773 | make_number (old_point), |
| 5820 | XWINDOW (data->current_window)->buffer); | 5774 | XWINDOW (data->current_window)->contents); |
| 5821 | 5775 | ||
| 5822 | /* In the following call to `select-window', prevent "swapping out | 5776 | /* In the following call to `select-window', prevent "swapping out |
| 5823 | point" in the old selected window using the buffer that has | 5777 | point" in the old selected window using the buffer that has |
| 5824 | been restored into it. We already swapped out that point from | 5778 | been restored into it. We already swapped out that point from |
| 5825 | that window's old buffer. */ | 5779 | that window's old buffer. */ |
| 5826 | select_window (data->current_window, Qnil, 1); | 5780 | select_window (data->current_window, Qnil, 1); |
| 5827 | BVAR (XBUFFER (XWINDOW (selected_window)->buffer), last_selected_window) | 5781 | BVAR (XBUFFER (XWINDOW (selected_window)->contents), last_selected_window) |
| 5828 | = selected_window; | 5782 | = selected_window; |
| 5829 | 5783 | ||
| 5830 | if (NILP (data->focus_frame) | 5784 | if (NILP (data->focus_frame) |
| @@ -5851,14 +5805,9 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5851 | /* Now, free glyph matrices in windows that were not reused. */ | 5805 | /* Now, free glyph matrices in windows that were not reused. */ |
| 5852 | for (i = n = 0; i < n_leaf_windows; ++i) | 5806 | for (i = n = 0; i < n_leaf_windows; ++i) |
| 5853 | { | 5807 | { |
| 5854 | if (NILP (leaf_windows[i]->buffer)) | 5808 | if (NILP (leaf_windows[i]->contents)) |
| 5855 | { | 5809 | free_window_matrices (leaf_windows[i]); |
| 5856 | /* Assert it's not reused as a combination. */ | 5810 | else if (EQ (leaf_windows[i]->contents, new_current_buffer)) |
| 5857 | eassert (NILP (leaf_windows[i]->hchild) | ||
| 5858 | && NILP (leaf_windows[i]->vchild)); | ||
| 5859 | free_window_matrices (leaf_windows[i]); | ||
| 5860 | } | ||
| 5861 | else if (EQ (leaf_windows[i]->buffer, new_current_buffer)) | ||
| 5862 | ++n; | 5811 | ++n; |
| 5863 | } | 5812 | } |
| 5864 | 5813 | ||
| @@ -5889,7 +5838,7 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5889 | Fset_buffer (new_current_buffer); | 5838 | Fset_buffer (new_current_buffer); |
| 5890 | /* If the new current buffer doesn't appear in the selected | 5839 | /* If the new current buffer doesn't appear in the selected |
| 5891 | window, go to its old point (see bug#12208). */ | 5840 | window, go to its old point (see bug#12208). */ |
| 5892 | if (!EQ (XWINDOW (data->current_window)->buffer, new_current_buffer)) | 5841 | if (!EQ (XWINDOW (data->current_window)->contents, new_current_buffer)) |
| 5893 | Fgoto_char (make_number (old_point)); | 5842 | Fgoto_char (make_number (old_point)); |
| 5894 | } | 5843 | } |
| 5895 | 5844 | ||
| @@ -5900,8 +5849,10 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5900 | } | 5849 | } |
| 5901 | 5850 | ||
| 5902 | 5851 | ||
| 5903 | /* Recursively delete all child windows reachable via the next, vchild, | 5852 | /* If WINDOW is an internal window, recursively delete all child windows |
| 5904 | and hchild slots of WINDOW. */ | 5853 | reachable via the next and contents slots of WINDOW. Otherwise setup |
| 5854 | WINDOW to not show any buffer. */ | ||
| 5855 | |||
| 5905 | void | 5856 | void |
| 5906 | delete_all_child_windows (Lisp_Object window) | 5857 | delete_all_child_windows (Lisp_Object window) |
| 5907 | { | 5858 | { |
| @@ -5913,17 +5864,12 @@ delete_all_child_windows (Lisp_Object window) | |||
| 5913 | /* Delete WINDOW's siblings (we traverse postorderly). */ | 5864 | /* Delete WINDOW's siblings (we traverse postorderly). */ |
| 5914 | delete_all_child_windows (w->next); | 5865 | delete_all_child_windows (w->next); |
| 5915 | 5866 | ||
| 5916 | if (!NILP (w->vchild)) | 5867 | if (WINDOWP (w->contents)) |
| 5917 | { | ||
| 5918 | delete_all_child_windows (w->vchild); | ||
| 5919 | wset_vchild (w, Qnil); | ||
| 5920 | } | ||
| 5921 | else if (!NILP (w->hchild)) | ||
| 5922 | { | 5868 | { |
| 5923 | delete_all_child_windows (w->hchild); | 5869 | delete_all_child_windows (w->contents); |
| 5924 | wset_hchild (w, Qnil); | 5870 | wset_combination (w, 0, Qnil); |
| 5925 | } | 5871 | } |
| 5926 | else if (!NILP (w->buffer)) | 5872 | else if (BUFFERP (w->contents)) |
| 5927 | { | 5873 | { |
| 5928 | unshow_buffer (w); | 5874 | unshow_buffer (w); |
| 5929 | unchain_marker (XMARKER (w->pointm)); | 5875 | unchain_marker (XMARKER (w->pointm)); |
| @@ -5931,7 +5877,7 @@ delete_all_child_windows (Lisp_Object window) | |||
| 5931 | /* Since combination limit makes sense for an internal windows | 5877 | /* Since combination limit makes sense for an internal windows |
| 5932 | only, we use this slot to save the buffer for the sake of | 5878 | only, we use this slot to save the buffer for the sake of |
| 5933 | possible resurrection in Fset_window_configuration. */ | 5879 | possible resurrection in Fset_window_configuration. */ |
| 5934 | wset_combination_limit (w, w->buffer); | 5880 | wset_combination_limit (w, w->contents); |
| 5935 | wset_buffer (w, Qnil); | 5881 | wset_buffer (w, Qnil); |
| 5936 | } | 5882 | } |
| 5937 | 5883 | ||
| @@ -5944,10 +5890,8 @@ count_windows (register struct window *window) | |||
| 5944 | register int count = 1; | 5890 | register int count = 1; |
| 5945 | if (!NILP (window->next)) | 5891 | if (!NILP (window->next)) |
| 5946 | count += count_windows (XWINDOW (window->next)); | 5892 | count += count_windows (XWINDOW (window->next)); |
| 5947 | if (!NILP (window->vchild)) | 5893 | if (WINDOWP (window->contents)) |
| 5948 | count += count_windows (XWINDOW (window->vchild)); | 5894 | count += count_windows (XWINDOW (window->contents)); |
| 5949 | if (!NILP (window->hchild)) | ||
| 5950 | count += count_windows (XWINDOW (window->hchild)); | ||
| 5951 | return count; | 5895 | return count; |
| 5952 | } | 5896 | } |
| 5953 | 5897 | ||
| @@ -5959,10 +5903,8 @@ get_leaf_windows (struct window *w, struct window **flat, int i) | |||
| 5959 | { | 5903 | { |
| 5960 | while (w) | 5904 | while (w) |
| 5961 | { | 5905 | { |
| 5962 | if (!NILP (w->hchild)) | 5906 | if (WINDOWP (w->contents)) |
| 5963 | i = get_leaf_windows (XWINDOW (w->hchild), flat, i); | 5907 | i = get_leaf_windows (XWINDOW (w->contents), flat, i); |
| 5964 | else if (!NILP (w->vchild)) | ||
| 5965 | i = get_leaf_windows (XWINDOW (w->vchild), flat, i); | ||
| 5966 | else | 5908 | else |
| 5967 | flat[i++] = w; | 5909 | flat[i++] = w; |
| 5968 | 5910 | ||
| @@ -6018,14 +5960,14 @@ save_window_save (Lisp_Object window, struct Lisp_Vector *vector, int i) | |||
| 6018 | register struct window *w; | 5960 | register struct window *w; |
| 6019 | register Lisp_Object tem, pers, par; | 5961 | register Lisp_Object tem, pers, par; |
| 6020 | 5962 | ||
| 6021 | for (;!NILP (window); window = w->next) | 5963 | for (; !NILP (window); window = w->next) |
| 6022 | { | 5964 | { |
| 6023 | p = SAVED_WINDOW_N (vector, i); | 5965 | p = SAVED_WINDOW_N (vector, i); |
| 6024 | w = XWINDOW (window); | 5966 | w = XWINDOW (window); |
| 6025 | 5967 | ||
| 6026 | wset_temslot (w, make_number (i)); i++; | 5968 | wset_temslot (w, make_number (i)); i++; |
| 6027 | p->window = window; | 5969 | p->window = window; |
| 6028 | p->buffer = w->buffer; | 5970 | p->buffer = (WINDOW_LEAF_P (w) ? w->contents : Qnil); |
| 6029 | p->left_col = make_number (w->left_col); | 5971 | p->left_col = make_number (w->left_col); |
| 6030 | p->top_line = make_number (w->top_line); | 5972 | p->top_line = make_number (w->top_line); |
| 6031 | p->total_cols = make_number (w->total_cols); | 5973 | p->total_cols = make_number (w->total_cols); |
| @@ -6092,15 +6034,15 @@ save_window_save (Lisp_Object window, struct Lisp_Vector *vector, int i) | |||
| 6092 | } | 6034 | } |
| 6093 | } | 6035 | } |
| 6094 | 6036 | ||
| 6095 | if (!NILP (w->buffer)) | 6037 | if (BUFFERP (w->contents)) |
| 6096 | { | 6038 | { |
| 6097 | /* Save w's value of point in the window configuration. If w | 6039 | /* Save w's value of point in the window configuration. If w |
| 6098 | is the selected window, then get the value of point from | 6040 | is the selected window, then get the value of point from |
| 6099 | the buffer; pointm is garbage in the selected window. */ | 6041 | the buffer; pointm is garbage in the selected window. */ |
| 6100 | if (EQ (window, selected_window)) | 6042 | if (EQ (window, selected_window)) |
| 6101 | p->pointm = build_marker (XBUFFER (w->buffer), | 6043 | p->pointm = build_marker (XBUFFER (w->contents), |
| 6102 | BUF_PT (XBUFFER (w->buffer)), | 6044 | BUF_PT (XBUFFER (w->contents)), |
| 6103 | BUF_PT_BYTE (XBUFFER (w->buffer))); | 6045 | BUF_PT_BYTE (XBUFFER (w->contents))); |
| 6104 | else | 6046 | else |
| 6105 | p->pointm = Fcopy_marker (w->pointm, Qnil); | 6047 | p->pointm = Fcopy_marker (w->pointm, Qnil); |
| 6106 | XMARKER (p->pointm)->insertion_type | 6048 | XMARKER (p->pointm)->insertion_type |
| @@ -6109,7 +6051,7 @@ save_window_save (Lisp_Object window, struct Lisp_Vector *vector, int i) | |||
| 6109 | p->start = Fcopy_marker (w->start, Qnil); | 6051 | p->start = Fcopy_marker (w->start, Qnil); |
| 6110 | p->start_at_line_beg = w->start_at_line_beg ? Qt : Qnil; | 6052 | p->start_at_line_beg = w->start_at_line_beg ? Qt : Qnil; |
| 6111 | 6053 | ||
| 6112 | tem = BVAR (XBUFFER (w->buffer), mark); | 6054 | tem = BVAR (XBUFFER (w->contents), mark); |
| 6113 | p->mark = Fcopy_marker (tem, Qnil); | 6055 | p->mark = Fcopy_marker (tem, Qnil); |
| 6114 | } | 6056 | } |
| 6115 | else | 6057 | else |
| @@ -6130,10 +6072,8 @@ save_window_save (Lisp_Object window, struct Lisp_Vector *vector, int i) | |||
| 6130 | else | 6072 | else |
| 6131 | p->prev = XWINDOW (w->prev)->temslot; | 6073 | p->prev = XWINDOW (w->prev)->temslot; |
| 6132 | 6074 | ||
| 6133 | if (!NILP (w->vchild)) | 6075 | if (WINDOWP (w->contents)) |
| 6134 | i = save_window_save (w->vchild, vector, i); | 6076 | i = save_window_save (w->contents, vector, i); |
| 6135 | if (!NILP (w->hchild)) | ||
| 6136 | i = save_window_save (w->hchild, vector, i); | ||
| 6137 | } | 6077 | } |
| 6138 | 6078 | ||
| 6139 | return i; | 6079 | return i; |
| @@ -6450,7 +6390,7 @@ If PIXELS-P is non-nil, the return value is VSCROLL. */) | |||
| 6450 | adjust_glyphs (f); | 6390 | adjust_glyphs (f); |
| 6451 | 6391 | ||
| 6452 | /* Prevent redisplay shortcuts. */ | 6392 | /* Prevent redisplay shortcuts. */ |
| 6453 | XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1; | 6393 | XBUFFER (w->contents)->prevent_redisplay_optimizations_p = 1; |
| 6454 | } | 6394 | } |
| 6455 | } | 6395 | } |
| 6456 | 6396 | ||
| @@ -6484,10 +6424,8 @@ foreach_window_1 (struct window *w, int (*fn) (struct window *, void *), void *u | |||
| 6484 | 6424 | ||
| 6485 | for (cont = 1; w && cont;) | 6425 | for (cont = 1; w && cont;) |
| 6486 | { | 6426 | { |
| 6487 | if (!NILP (w->hchild)) | 6427 | if (WINDOWP (w->contents)) |
| 6488 | cont = foreach_window_1 (XWINDOW (w->hchild), fn, user_data); | 6428 | cont = foreach_window_1 (XWINDOW (w->contents), fn, user_data); |
| 6489 | else if (!NILP (w->vchild)) | ||
| 6490 | cont = foreach_window_1 (XWINDOW (w->vchild), fn, user_data); | ||
| 6491 | else | 6429 | else |
| 6492 | cont = fn (w, user_data); | 6430 | cont = fn (w, user_data); |
| 6493 | 6431 | ||