diff options
| author | Tom Tromey | 2013-06-03 12:25:05 -0600 |
|---|---|---|
| committer | Tom Tromey | 2013-06-03 12:25:05 -0600 |
| commit | 68359abba96d7ec4db8aab3d3dd9cf1105c3bab5 (patch) | |
| tree | 862703e7e1a1888170136a8296a5750d6b2ae2eb /src/window.c | |
| parent | cbcba8ce7f980b01c18c0fd561ef6687b1361507 (diff) | |
| parent | e2d8a6f0a229b4ebe26484b892ec4f14888f58b6 (diff) | |
| download | emacs-68359abba96d7ec4db8aab3d3dd9cf1105c3bab5.tar.gz emacs-68359abba96d7ec4db8aab3d3dd9cf1105c3bab5.zip | |
merge from trunk; clean up some issues
Diffstat (limited to 'src/window.c')
| -rw-r--r-- | src/window.c | 739 |
1 files changed, 343 insertions, 396 deletions
diff --git a/src/window.c b/src/window.c index 4109b752d8e..33bf70b75c8 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -84,8 +84,8 @@ static int foreach_window_1 (struct window *, | |||
| 84 | int (* fn) (struct window *, void *), | 84 | int (* fn) (struct window *, void *), |
| 85 | void *); | 85 | void *); |
| 86 | static Lisp_Object window_list_1 (Lisp_Object, Lisp_Object, Lisp_Object); | 86 | static Lisp_Object window_list_1 (Lisp_Object, Lisp_Object, Lisp_Object); |
| 87 | static int window_resize_check (struct window *, int); | 87 | static int window_resize_check (struct window *, bool); |
| 88 | static void window_resize_apply (struct window *, int); | 88 | static void window_resize_apply (struct window *, bool); |
| 89 | static Lisp_Object select_window (Lisp_Object, Lisp_Object, int); | 89 | static Lisp_Object select_window (Lisp_Object, Lisp_Object, int); |
| 90 | static void select_window_1 (Lisp_Object, bool); | 90 | static void select_window_1 (Lisp_Object, bool); |
| 91 | 91 | ||
| @@ -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 | } |
| @@ -486,17 +485,14 @@ select_window (Lisp_Object window, Lisp_Object norecord, int inhibit_point_swap) | |||
| 486 | w = XWINDOW (window); | 485 | w = XWINDOW (window); |
| 487 | w->frozen_window_start_p = 0; | 486 | w->frozen_window_start_p = 0; |
| 488 | 487 | ||
| 489 | if (NILP (norecord)) | ||
| 490 | { | ||
| 491 | w->use_time = ++window_select_count; | ||
| 492 | record_buffer (w->buffer); | ||
| 493 | } | ||
| 494 | |||
| 495 | /* Make the selected window's buffer current. */ | 488 | /* Make the selected window's buffer current. */ |
| 496 | Fset_buffer (w->buffer); | 489 | Fset_buffer (w->contents); |
| 497 | 490 | ||
| 498 | if (EQ (window, selected_window) && !inhibit_point_swap) | 491 | if (EQ (window, selected_window) && !inhibit_point_swap) |
| 499 | return window; | 492 | /* `switch-to-buffer' uses (select-window (selected-window)) as a "clever" |
| 493 | way to call record_buffer from Elisp, so it's important that we call | ||
| 494 | record_buffer before returning here. */ | ||
| 495 | goto record_and_return; | ||
| 500 | 496 | ||
| 501 | sf = SELECTED_FRAME (); | 497 | sf = SELECTED_FRAME (); |
| 502 | if (XFRAME (WINDOW_FRAME (w)) != sf) | 498 | if (XFRAME (WINDOW_FRAME (w)) != sf) |
| @@ -515,9 +511,19 @@ select_window (Lisp_Object window, Lisp_Object norecord, int inhibit_point_swap) | |||
| 515 | fset_selected_window (sf, window); | 511 | fset_selected_window (sf, window); |
| 516 | 512 | ||
| 517 | select_window_1 (window, inhibit_point_swap); | 513 | select_window_1 (window, inhibit_point_swap); |
| 518 | 514 | bset_last_selected_window (XBUFFER (w->contents), window); | |
| 519 | bset_last_selected_window (XBUFFER (w->buffer), window); | ||
| 520 | windows_or_buffers_changed++; | 515 | windows_or_buffers_changed++; |
| 516 | |||
| 517 | record_and_return: | ||
| 518 | /* record_buffer can run QUIT, so make sure it is run only after we have | ||
| 519 | re-established the invariant between selected_window and selected_frame, | ||
| 520 | otherwise the temporary broken invariant might "escape" (bug#14161). */ | ||
| 521 | if (NILP (norecord)) | ||
| 522 | { | ||
| 523 | w->use_time = ++window_select_count; | ||
| 524 | record_buffer (w->contents); | ||
| 525 | } | ||
| 526 | |||
| 521 | return window; | 527 | return window; |
| 522 | } | 528 | } |
| 523 | 529 | ||
| @@ -533,10 +539,10 @@ select_window_1 (Lisp_Object window, bool inhibit_point_swap) | |||
| 533 | if (!inhibit_point_swap) | 539 | if (!inhibit_point_swap) |
| 534 | { | 540 | { |
| 535 | struct window *ow = XWINDOW (selected_window); | 541 | struct window *ow = XWINDOW (selected_window); |
| 536 | if (! NILP (ow->buffer)) | 542 | if (BUFFERP (ow->contents)) |
| 537 | set_marker_both (ow->pointm, ow->buffer, | 543 | set_marker_both (ow->pointm, ow->contents, |
| 538 | BUF_PT (XBUFFER (ow->buffer)), | 544 | BUF_PT (XBUFFER (ow->contents)), |
| 539 | BUF_PT_BYTE (XBUFFER (ow->buffer))); | 545 | BUF_PT_BYTE (XBUFFER (ow->contents))); |
| 540 | } | 546 | } |
| 541 | 547 | ||
| 542 | selected_window = window; | 548 | selected_window = window; |
| @@ -581,7 +587,8 @@ If WINDOW is omitted or nil, it defaults to the selected window. | |||
| 581 | Return nil for an internal window or a deleted window. */) | 587 | Return nil for an internal window or a deleted window. */) |
| 582 | (Lisp_Object window) | 588 | (Lisp_Object window) |
| 583 | { | 589 | { |
| 584 | return decode_any_window (window)->buffer; | 590 | struct window *w = decode_any_window (window); |
| 591 | return WINDOW_LEAF_P (w) ? w->contents : Qnil; | ||
| 585 | } | 592 | } |
| 586 | 593 | ||
| 587 | DEFUN ("window-parent", Fwindow_parent, Swindow_parent, 0, 1, 0, | 594 | DEFUN ("window-parent", Fwindow_parent, Swindow_parent, 0, 1, 0, |
| @@ -601,7 +608,8 @@ Return nil if WINDOW is an internal window whose children form a | |||
| 601 | horizontal combination. */) | 608 | horizontal combination. */) |
| 602 | (Lisp_Object window) | 609 | (Lisp_Object window) |
| 603 | { | 610 | { |
| 604 | return decode_valid_window (window)->vchild; | 611 | struct window *w = decode_valid_window (window); |
| 612 | return WINDOW_VERTICAL_COMBINATION_P (w) ? w->contents : Qnil; | ||
| 605 | } | 613 | } |
| 606 | 614 | ||
| 607 | DEFUN ("window-left-child", Fwindow_left_child, Swindow_left_child, 0, 1, 0, | 615 | DEFUN ("window-left-child", Fwindow_left_child, Swindow_left_child, 0, 1, 0, |
| @@ -612,7 +620,8 @@ Return nil if WINDOW is an internal window whose children form a | |||
| 612 | vertical combination. */) | 620 | vertical combination. */) |
| 613 | (Lisp_Object window) | 621 | (Lisp_Object window) |
| 614 | { | 622 | { |
| 615 | return decode_valid_window (window)->hchild; | 623 | struct window *w = decode_valid_window (window); |
| 624 | return WINDOW_HORIZONTAL_COMBINATION_P (w) ? w->contents : Qnil; | ||
| 616 | } | 625 | } |
| 617 | 626 | ||
| 618 | DEFUN ("window-next-sibling", Fwindow_next_sibling, Swindow_next_sibling, 0, 1, 0, | 627 | DEFUN ("window-next-sibling", Fwindow_next_sibling, Swindow_next_sibling, 0, 1, 0, |
| @@ -635,30 +644,37 @@ Return nil if WINDOW has no previous sibling. */) | |||
| 635 | 644 | ||
| 636 | DEFUN ("window-combination-limit", Fwindow_combination_limit, Swindow_combination_limit, 1, 1, 0, | 645 | DEFUN ("window-combination-limit", Fwindow_combination_limit, Swindow_combination_limit, 1, 1, 0, |
| 637 | doc: /* Return combination limit of window WINDOW. | 646 | doc: /* Return combination limit of window WINDOW. |
| 647 | WINDOW must be a valid window used in horizontal or vertical combination. | ||
| 638 | If the return value is nil, child windows of WINDOW can be recombined with | 648 | If the return value is nil, child windows of WINDOW can be recombined with |
| 639 | WINDOW's siblings. A return value of t means that child windows of | 649 | WINDOW's siblings. A return value of t means that child windows of |
| 640 | WINDOW are never \(re-)combined with WINDOW's siblings. | 650 | WINDOW are never \(re-)combined with WINDOW's siblings. */) |
| 641 | |||
| 642 | WINDOW must be a valid window. The return value is meaningful for | ||
| 643 | internal windows only. */) | ||
| 644 | (Lisp_Object window) | 651 | (Lisp_Object window) |
| 645 | { | 652 | { |
| 653 | struct window *w; | ||
| 654 | |||
| 646 | CHECK_VALID_WINDOW (window); | 655 | CHECK_VALID_WINDOW (window); |
| 647 | return XWINDOW (window)->combination_limit; | 656 | w = XWINDOW (window); |
| 657 | if (WINDOW_LEAF_P (w)) | ||
| 658 | error ("Combination limit is meaningful for internal windows only"); | ||
| 659 | return w->combination_limit; | ||
| 648 | } | 660 | } |
| 649 | 661 | ||
| 650 | DEFUN ("set-window-combination-limit", Fset_window_combination_limit, Sset_window_combination_limit, 2, 2, 0, | 662 | DEFUN ("set-window-combination-limit", Fset_window_combination_limit, Sset_window_combination_limit, 2, 2, 0, |
| 651 | doc: /* Set combination limit of window WINDOW to LIMIT; return LIMIT. | 663 | doc: /* Set combination limit of window WINDOW to LIMIT; return LIMIT. |
| 664 | WINDOW must be a valid window used in horizontal or vertical combination. | ||
| 652 | If LIMIT is nil, child windows of WINDOW can be recombined with WINDOW's | 665 | If LIMIT is nil, child windows of WINDOW can be recombined with WINDOW's |
| 653 | siblings. LIMIT t means that child windows of WINDOW are never | 666 | siblings. LIMIT t means that child windows of WINDOW are never |
| 654 | \(re-)combined with WINDOW's siblings. Other values are reserved for | 667 | \(re-)combined with WINDOW's siblings. Other values are reserved for |
| 655 | future use. | 668 | future use. */) |
| 656 | |||
| 657 | WINDOW must be a valid window. Setting the combination limit is | ||
| 658 | meaningful for internal windows only. */) | ||
| 659 | (Lisp_Object window, Lisp_Object limit) | 669 | (Lisp_Object window, Lisp_Object limit) |
| 660 | { | 670 | { |
| 661 | wset_combination_limit (decode_valid_window (window), limit); | 671 | struct window *w; |
| 672 | |||
| 673 | CHECK_VALID_WINDOW (window); | ||
| 674 | w = XWINDOW (window); | ||
| 675 | if (WINDOW_LEAF_P (w)) | ||
| 676 | error ("Combination limit is meaningful for internal windows only"); | ||
| 677 | wset_combination_limit (w, limit); | ||
| 662 | return limit; | 678 | return limit; |
| 663 | } | 679 | } |
| 664 | 680 | ||
| @@ -685,7 +701,7 @@ On a graphical display, this total height is reported as an | |||
| 685 | integer multiple of the default character height. */) | 701 | integer multiple of the default character height. */) |
| 686 | (Lisp_Object window) | 702 | (Lisp_Object window) |
| 687 | { | 703 | { |
| 688 | return decode_valid_window (window)->total_lines; | 704 | return make_number (decode_valid_window (window)->total_lines); |
| 689 | } | 705 | } |
| 690 | 706 | ||
| 691 | DEFUN ("window-total-width", Fwindow_total_width, Swindow_total_width, 0, 1, 0, | 707 | DEFUN ("window-total-width", Fwindow_total_width, Swindow_total_width, 0, 1, 0, |
| @@ -700,7 +716,7 @@ On a graphical display, this total width is reported as an | |||
| 700 | integer multiple of the default character width. */) | 716 | integer multiple of the default character width. */) |
| 701 | (Lisp_Object window) | 717 | (Lisp_Object window) |
| 702 | { | 718 | { |
| 703 | return decode_valid_window (window)->total_cols; | 719 | return make_number (decode_valid_window (window)->total_cols); |
| 704 | } | 720 | } |
| 705 | 721 | ||
| 706 | DEFUN ("window-new-total", Fwindow_new_total, Swindow_new_total, 0, 1, 0, | 722 | DEFUN ("window-new-total", Fwindow_new_total, Swindow_new_total, 0, 1, 0, |
| @@ -739,7 +755,7 @@ value is 0 if there is no window to the left of WINDOW. | |||
| 739 | WINDOW must be a valid window and defaults to the selected one. */) | 755 | WINDOW must be a valid window and defaults to the selected one. */) |
| 740 | (Lisp_Object window) | 756 | (Lisp_Object window) |
| 741 | { | 757 | { |
| 742 | return decode_valid_window (window)->left_col; | 758 | return make_number (decode_valid_window (window)->left_col); |
| 743 | } | 759 | } |
| 744 | 760 | ||
| 745 | DEFUN ("window-top-line", Fwindow_top_line, Swindow_top_line, 0, 1, 0, | 761 | DEFUN ("window-top-line", Fwindow_top_line, Swindow_top_line, 0, 1, 0, |
| @@ -751,7 +767,7 @@ there is no window above WINDOW. | |||
| 751 | WINDOW must be a valid window and defaults to the selected one. */) | 767 | WINDOW must be a valid window and defaults to the selected one. */) |
| 752 | (Lisp_Object window) | 768 | (Lisp_Object window) |
| 753 | { | 769 | { |
| 754 | return decode_valid_window (window)->top_line; | 770 | return make_number (decode_valid_window (window)->top_line); |
| 755 | } | 771 | } |
| 756 | 772 | ||
| 757 | /* Return the number of lines of W's body. Don't count any mode or | 773 | /* Return the number of lines of W's body. Don't count any mode or |
| @@ -760,7 +776,7 @@ WINDOW must be a valid window and defaults to the selected one. */) | |||
| 760 | static int | 776 | static int |
| 761 | window_body_lines (struct window *w) | 777 | window_body_lines (struct window *w) |
| 762 | { | 778 | { |
| 763 | int height = XFASTINT (w->total_lines); | 779 | int height = w->total_lines; |
| 764 | 780 | ||
| 765 | if (!MINI_WINDOW_P (w)) | 781 | if (!MINI_WINDOW_P (w)) |
| 766 | { | 782 | { |
| @@ -782,7 +798,7 @@ int | |||
| 782 | window_body_cols (struct window *w) | 798 | window_body_cols (struct window *w) |
| 783 | { | 799 | { |
| 784 | struct frame *f = XFRAME (WINDOW_FRAME (w)); | 800 | struct frame *f = XFRAME (WINDOW_FRAME (w)); |
| 785 | int width = XINT (w->total_cols); | 801 | int width = w->total_cols; |
| 786 | 802 | ||
| 787 | if (WINDOW_HAS_VERTICAL_SCROLL_BAR (w)) | 803 | if (WINDOW_HAS_VERTICAL_SCROLL_BAR (w)) |
| 788 | /* Scroll bars occupy a few columns. */ | 804 | /* Scroll bars occupy a few columns. */ |
| @@ -853,7 +869,7 @@ set_window_hscroll (struct window *w, EMACS_INT hscroll) | |||
| 853 | 869 | ||
| 854 | /* Prevent redisplay shortcuts when changing the hscroll. */ | 870 | /* Prevent redisplay shortcuts when changing the hscroll. */ |
| 855 | if (w->hscroll != new_hscroll) | 871 | if (w->hscroll != new_hscroll) |
| 856 | XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1; | 872 | XBUFFER (w->contents)->prevent_redisplay_optimizations_p = 1; |
| 857 | 873 | ||
| 858 | w->hscroll = new_hscroll; | 874 | w->hscroll = new_hscroll; |
| 859 | return make_number (new_hscroll); | 875 | return make_number (new_hscroll); |
| @@ -1368,7 +1384,7 @@ check_window_containing (struct window *w, void *user_data) | |||
| 1368 | 1384 | ||
| 1369 | Lisp_Object | 1385 | Lisp_Object |
| 1370 | window_from_coordinates (struct frame *f, int x, int y, | 1386 | window_from_coordinates (struct frame *f, int x, int y, |
| 1371 | enum window_part *part, int tool_bar_p) | 1387 | enum window_part *part, bool tool_bar_p) |
| 1372 | { | 1388 | { |
| 1373 | Lisp_Object window; | 1389 | Lisp_Object window; |
| 1374 | struct check_window_data cw; | 1390 | struct check_window_data cw; |
| @@ -1434,7 +1450,7 @@ correct to return the top-level value of `point', outside of any | |||
| 1434 | register struct window *w = decode_live_window (window); | 1450 | register struct window *w = decode_live_window (window); |
| 1435 | 1451 | ||
| 1436 | if (w == XWINDOW (selected_window)) | 1452 | if (w == XWINDOW (selected_window)) |
| 1437 | return make_number (BUF_PT (XBUFFER (w->buffer))); | 1453 | return make_number (BUF_PT (XBUFFER (w->contents))); |
| 1438 | else | 1454 | else |
| 1439 | return Fmarker_position (w->pointm); | 1455 | return Fmarker_position (w->pointm); |
| 1440 | } | 1456 | } |
| @@ -1476,12 +1492,17 @@ if it isn't already recorded. */) | |||
| 1476 | Lisp_Object buf; | 1492 | Lisp_Object buf; |
| 1477 | struct buffer *b; | 1493 | struct buffer *b; |
| 1478 | 1494 | ||
| 1479 | buf = w->buffer; | 1495 | buf = w->contents; |
| 1480 | CHECK_BUFFER (buf); | 1496 | CHECK_BUFFER (buf); |
| 1481 | b = XBUFFER (buf); | 1497 | b = XBUFFER (buf); |
| 1482 | 1498 | ||
| 1483 | if (! NILP (update) | 1499 | if (! NILP (update) |
| 1484 | && (windows_or_buffers_changed || !w->window_end_valid) | 1500 | && (windows_or_buffers_changed |
| 1501 | || !w->window_end_valid | ||
| 1502 | || b->clip_changed | ||
| 1503 | || b->prevent_redisplay_optimizations_p | ||
| 1504 | || w->last_modified < BUF_MODIFF (b) | ||
| 1505 | || w->last_overlay_modified < BUF_OVERLAY_MODIFF (b)) | ||
| 1485 | && !noninteractive) | 1506 | && !noninteractive) |
| 1486 | { | 1507 | { |
| 1487 | struct text_pos startp; | 1508 | struct text_pos startp; |
| @@ -1539,7 +1560,7 @@ Return POS. */) | |||
| 1539 | 1560 | ||
| 1540 | if (w == XWINDOW (selected_window)) | 1561 | if (w == XWINDOW (selected_window)) |
| 1541 | { | 1562 | { |
| 1542 | if (XBUFFER (w->buffer) == current_buffer) | 1563 | if (XBUFFER (w->contents) == current_buffer) |
| 1543 | Fgoto_char (pos); | 1564 | Fgoto_char (pos); |
| 1544 | else | 1565 | else |
| 1545 | { | 1566 | { |
| @@ -1547,14 +1568,14 @@ Return POS. */) | |||
| 1547 | 1568 | ||
| 1548 | /* ... but here we want to catch type error before buffer change. */ | 1569 | /* ... but here we want to catch type error before buffer change. */ |
| 1549 | CHECK_NUMBER_COERCE_MARKER (pos); | 1570 | CHECK_NUMBER_COERCE_MARKER (pos); |
| 1550 | set_buffer_internal (XBUFFER (w->buffer)); | 1571 | set_buffer_internal (XBUFFER (w->contents)); |
| 1551 | Fgoto_char (pos); | 1572 | Fgoto_char (pos); |
| 1552 | set_buffer_internal (old_buffer); | 1573 | set_buffer_internal (old_buffer); |
| 1553 | } | 1574 | } |
| 1554 | } | 1575 | } |
| 1555 | else | 1576 | else |
| 1556 | { | 1577 | { |
| 1557 | set_marker_restricted (w->pointm, pos, w->buffer); | 1578 | set_marker_restricted (w->pointm, pos, w->contents); |
| 1558 | /* We have to make sure that redisplay updates the window to show | 1579 | /* We have to make sure that redisplay updates the window to show |
| 1559 | the new value of point. */ | 1580 | the new value of point. */ |
| 1560 | ++windows_or_buffers_changed; | 1581 | ++windows_or_buffers_changed; |
| @@ -1572,7 +1593,7 @@ overriding motion of point in order to display at this exact start. */) | |||
| 1572 | { | 1593 | { |
| 1573 | register struct window *w = decode_live_window (window); | 1594 | register struct window *w = decode_live_window (window); |
| 1574 | 1595 | ||
| 1575 | set_marker_restricted (w->start, pos, w->buffer); | 1596 | set_marker_restricted (w->start, pos, w->contents); |
| 1576 | /* This is not right, but much easier than doing what is right. */ | 1597 | /* This is not right, but much easier than doing what is right. */ |
| 1577 | w->start_at_line_beg = 0; | 1598 | w->start_at_line_beg = 0; |
| 1578 | if (NILP (noforce)) | 1599 | if (NILP (noforce)) |
| @@ -1616,7 +1637,7 @@ display row, and VPOS is the row number (0-based) containing POS. */) | |||
| 1616 | int x, y; | 1637 | int x, y; |
| 1617 | 1638 | ||
| 1618 | w = decode_live_window (window); | 1639 | w = decode_live_window (window); |
| 1619 | buf = XBUFFER (w->buffer); | 1640 | buf = XBUFFER (w->contents); |
| 1620 | SET_TEXT_POS_FROM_MARKER (top, w->start); | 1641 | SET_TEXT_POS_FROM_MARKER (top, w->start); |
| 1621 | 1642 | ||
| 1622 | if (EQ (pos, Qt)) | 1643 | if (EQ (pos, Qt)) |
| @@ -1685,13 +1706,14 @@ Return nil if window display is not up-to-date. In that case, use | |||
| 1685 | if (noninteractive || w->pseudo_window_p) | 1706 | if (noninteractive || w->pseudo_window_p) |
| 1686 | return Qnil; | 1707 | return Qnil; |
| 1687 | 1708 | ||
| 1688 | CHECK_BUFFER (w->buffer); | 1709 | CHECK_BUFFER (w->contents); |
| 1689 | b = XBUFFER (w->buffer); | 1710 | b = XBUFFER (w->contents); |
| 1690 | 1711 | ||
| 1691 | /* Fail if current matrix is not up-to-date. */ | 1712 | /* Fail if current matrix is not up-to-date. */ |
| 1692 | if (!w->window_end_valid | 1713 | if (!w->window_end_valid |
| 1693 | || current_buffer->clip_changed | 1714 | || windows_or_buffers_changed |
| 1694 | || current_buffer->prevent_redisplay_optimizations_p | 1715 | || b->clip_changed |
| 1716 | || b->prevent_redisplay_optimizations_p | ||
| 1695 | || w->last_modified < BUF_MODIFF (b) | 1717 | || w->last_modified < BUF_MODIFF (b) |
| 1696 | || w->last_overlay_modified < BUF_OVERLAY_MODIFF (b)) | 1718 | || w->last_overlay_modified < BUF_OVERLAY_MODIFF (b)) |
| 1697 | return Qnil; | 1719 | return Qnil; |
| @@ -1912,9 +1934,9 @@ window_display_table (struct window *w) | |||
| 1912 | 1934 | ||
| 1913 | if (DISP_TABLE_P (w->display_table)) | 1935 | if (DISP_TABLE_P (w->display_table)) |
| 1914 | dp = XCHAR_TABLE (w->display_table); | 1936 | dp = XCHAR_TABLE (w->display_table); |
| 1915 | else if (BUFFERP (w->buffer)) | 1937 | else if (BUFFERP (w->contents)) |
| 1916 | { | 1938 | { |
| 1917 | struct buffer *b = XBUFFER (w->buffer); | 1939 | struct buffer *b = XBUFFER (w->contents); |
| 1918 | 1940 | ||
| 1919 | if (DISP_TABLE_P (BVAR (b, display_table))) | 1941 | if (DISP_TABLE_P (BVAR (b, display_table))) |
| 1920 | dp = XCHAR_TABLE (BVAR (b, display_table)); | 1942 | dp = XCHAR_TABLE (BVAR (b, display_table)); |
| @@ -1939,17 +1961,14 @@ WINDOW must be a live window and defaults to the selected one. */) | |||
| 1939 | static void | 1961 | static void |
| 1940 | unshow_buffer (register struct window *w) | 1962 | unshow_buffer (register struct window *w) |
| 1941 | { | 1963 | { |
| 1942 | Lisp_Object buf; | 1964 | Lisp_Object buf = w->contents; |
| 1943 | struct buffer *b; | 1965 | struct buffer *b = XBUFFER (buf); |
| 1944 | 1966 | ||
| 1945 | buf = w->buffer; | 1967 | eassert (b == XMARKER (w->pointm)->buffer); |
| 1946 | b = XBUFFER (buf); | ||
| 1947 | if (b != XMARKER (w->pointm)->buffer) | ||
| 1948 | emacs_abort (); | ||
| 1949 | 1968 | ||
| 1950 | #if 0 | 1969 | #if 0 |
| 1951 | if (w == XWINDOW (selected_window) | 1970 | if (w == XWINDOW (selected_window) |
| 1952 | || ! EQ (buf, XWINDOW (selected_window)->buffer)) | 1971 | || ! EQ (buf, XWINDOW (selected_window)->contents)) |
| 1953 | /* Do this except when the selected window's buffer | 1972 | /* Do this except when the selected window's buffer |
| 1954 | is being removed from some other window. */ | 1973 | is being removed from some other window. */ |
| 1955 | #endif | 1974 | #endif |
| @@ -1965,14 +1984,14 @@ unshow_buffer (register struct window *w) | |||
| 1965 | /* Point in the selected window's buffer | 1984 | /* Point in the selected window's buffer |
| 1966 | is actually stored in that buffer, and the window's pointm isn't used. | 1985 | is actually stored in that buffer, and the window's pointm isn't used. |
| 1967 | So don't clobber point in that buffer. */ | 1986 | So don't clobber point in that buffer. */ |
| 1968 | if (! EQ (buf, XWINDOW (selected_window)->buffer) | 1987 | if (! EQ (buf, XWINDOW (selected_window)->contents) |
| 1969 | /* Don't clobber point in current buffer either (this could be | 1988 | /* Don't clobber point in current buffer either (this could be |
| 1970 | useful in connection with bug#12208). | 1989 | useful in connection with bug#12208). |
| 1971 | && XBUFFER (buf) != current_buffer */ | 1990 | && XBUFFER (buf) != current_buffer */ |
| 1972 | /* This line helps to fix Horsley's testbug.el bug. */ | 1991 | /* This line helps to fix Horsley's testbug.el bug. */ |
| 1973 | && !(WINDOWP (BVAR (b, last_selected_window)) | 1992 | && !(WINDOWP (BVAR (b, last_selected_window)) |
| 1974 | && w != XWINDOW (BVAR (b, last_selected_window)) | 1993 | && w != XWINDOW (BVAR (b, last_selected_window)) |
| 1975 | && EQ (buf, XWINDOW (BVAR (b, last_selected_window))->buffer))) | 1994 | && EQ (buf, XWINDOW (BVAR (b, last_selected_window))->contents))) |
| 1976 | temp_set_point_both (b, | 1995 | temp_set_point_both (b, |
| 1977 | clip_to_bounds (BUF_BEGV (b), | 1996 | clip_to_bounds (BUF_BEGV (b), |
| 1978 | marker_position (w->pointm), | 1997 | marker_position (w->pointm), |
| @@ -2000,12 +2019,12 @@ replace_window (Lisp_Object old, Lisp_Object new, int setflag) | |||
| 2000 | if (EQ (old, FRAME_ROOT_WINDOW (XFRAME (o->frame)))) | 2019 | if (EQ (old, FRAME_ROOT_WINDOW (XFRAME (o->frame)))) |
| 2001 | fset_root_window (XFRAME (o->frame), new); | 2020 | fset_root_window (XFRAME (o->frame), new); |
| 2002 | 2021 | ||
| 2003 | if (setflag) | 2022 | if (setflag) |
| 2004 | { | 2023 | { |
| 2005 | wset_left_col (n, o->left_col); | 2024 | n->left_col = o->left_col; |
| 2006 | wset_top_line (n, o->top_line); | 2025 | n->top_line = o->top_line; |
| 2007 | wset_total_cols (n, o->total_cols); | 2026 | n->total_cols = o->total_cols; |
| 2008 | wset_total_lines (n, o->total_lines); | 2027 | n->total_lines = o->total_lines; |
| 2009 | wset_normal_cols (n, o->normal_cols); | 2028 | wset_normal_cols (n, o->normal_cols); |
| 2010 | wset_normal_cols (o, make_float (1.0)); | 2029 | wset_normal_cols (o, make_float (1.0)); |
| 2011 | wset_normal_lines (n, o->normal_lines); | 2030 | wset_normal_lines (n, o->normal_lines); |
| @@ -2037,13 +2056,8 @@ replace_window (Lisp_Object old, Lisp_Object new, int setflag) | |||
| 2037 | 2056 | ||
| 2038 | tem = o->parent; | 2057 | tem = o->parent; |
| 2039 | wset_parent (n, tem); | 2058 | wset_parent (n, tem); |
| 2040 | if (!NILP (tem)) | 2059 | if (!NILP (tem) && EQ (XWINDOW (tem)->contents, old)) |
| 2041 | { | 2060 | wset_combination (XWINDOW (tem), XWINDOW (tem)->horizontal, new); |
| 2042 | if (EQ (XWINDOW (tem)->vchild, old)) | ||
| 2043 | wset_vchild (XWINDOW (tem), new); | ||
| 2044 | if (EQ (XWINDOW (tem)->hchild, old)) | ||
| 2045 | wset_hchild (XWINDOW (tem), new); | ||
| 2046 | } | ||
| 2047 | } | 2061 | } |
| 2048 | 2062 | ||
| 2049 | /* If window WINDOW and its parent window are iso-combined, merge | 2063 | /* If window WINDOW and its parent window are iso-combined, merge |
| @@ -2055,29 +2069,26 @@ recombine_windows (Lisp_Object window) | |||
| 2055 | { | 2069 | { |
| 2056 | struct window *w, *p, *c; | 2070 | struct window *w, *p, *c; |
| 2057 | Lisp_Object parent, child; | 2071 | Lisp_Object parent, child; |
| 2058 | int horflag; | 2072 | bool horflag; |
| 2059 | 2073 | ||
| 2060 | w = XWINDOW (window); | 2074 | w = XWINDOW (window); |
| 2061 | parent = w->parent; | 2075 | parent = w->parent; |
| 2062 | if (!NILP (parent) && NILP (w->combination_limit)) | 2076 | if (!NILP (parent) && NILP (w->combination_limit)) |
| 2063 | { | 2077 | { |
| 2064 | p = XWINDOW (parent); | 2078 | p = XWINDOW (parent); |
| 2065 | if (((!NILP (p->vchild) && !NILP (w->vchild)) | 2079 | if (WINDOWP (p->contents) && WINDOWP (w->contents) |
| 2066 | || (!NILP (p->hchild) && !NILP (w->hchild)))) | 2080 | && p->horizontal == w->horizontal) |
| 2067 | /* WINDOW and PARENT are both either a vertical or a horizontal | 2081 | /* WINDOW and PARENT are both either a vertical or a horizontal |
| 2068 | combination. */ | 2082 | combination. */ |
| 2069 | { | 2083 | { |
| 2070 | horflag = NILP (w->vchild); | 2084 | horflag = WINDOW_HORIZONTAL_COMBINATION_P (w); |
| 2071 | child = horflag ? w->hchild : w->vchild; | 2085 | child = w->contents; |
| 2072 | c = XWINDOW (child); | 2086 | c = XWINDOW (child); |
| 2073 | 2087 | ||
| 2074 | /* Splice WINDOW's children into its parent's children and | 2088 | /* Splice WINDOW's children into its parent's children and |
| 2075 | assign new normal sizes. */ | 2089 | assign new normal sizes. */ |
| 2076 | if (NILP (w->prev)) | 2090 | if (NILP (w->prev)) |
| 2077 | if (horflag) | 2091 | wset_combination (p, horflag, child); |
| 2078 | wset_hchild (p, child); | ||
| 2079 | else | ||
| 2080 | wset_vchild (p, child); | ||
| 2081 | else | 2092 | else |
| 2082 | { | 2093 | { |
| 2083 | wset_prev (c, w->prev); | 2094 | wset_prev (c, w->prev); |
| @@ -2090,12 +2101,12 @@ recombine_windows (Lisp_Object window) | |||
| 2090 | 2101 | ||
| 2091 | if (horflag) | 2102 | if (horflag) |
| 2092 | wset_normal_cols (c, | 2103 | wset_normal_cols (c, |
| 2093 | make_float (XFLOATINT (c->total_cols) | 2104 | make_float ((double) c->total_cols |
| 2094 | / XFLOATINT (p->total_cols))); | 2105 | / (double) p->total_cols)); |
| 2095 | else | 2106 | else |
| 2096 | wset_normal_lines (c, | 2107 | wset_normal_lines (c, |
| 2097 | make_float (XFLOATINT (c->total_lines) | 2108 | make_float ((double) c->total_lines |
| 2098 | / XFLOATINT (p->total_lines))); | 2109 | / (double) p->total_lines)); |
| 2099 | 2110 | ||
| 2100 | if (NILP (c->next)) | 2111 | if (NILP (c->next)) |
| 2101 | { | 2112 | { |
| @@ -2115,8 +2126,7 @@ recombine_windows (Lisp_Object window) | |||
| 2115 | } | 2126 | } |
| 2116 | 2127 | ||
| 2117 | /* WINDOW can be deleted now. */ | 2128 | /* WINDOW can be deleted now. */ |
| 2118 | wset_vchild (w, Qnil); | 2129 | wset_combination (w, 0, Qnil); |
| 2119 | wset_hchild (w, Qnil); | ||
| 2120 | } | 2130 | } |
| 2121 | } | 2131 | } |
| 2122 | } | 2132 | } |
| @@ -2202,7 +2212,7 @@ candidate_window_p (Lisp_Object window, Lisp_Object owindow, Lisp_Object minibuf | |||
| 2202 | struct frame *f = XFRAME (w->frame); | 2212 | struct frame *f = XFRAME (w->frame); |
| 2203 | int candidate_p = 1; | 2213 | int candidate_p = 1; |
| 2204 | 2214 | ||
| 2205 | if (!BUFFERP (w->buffer)) | 2215 | if (!BUFFERP (w->contents)) |
| 2206 | candidate_p = 0; | 2216 | candidate_p = 0; |
| 2207 | else if (MINI_WINDOW_P (w) | 2217 | else if (MINI_WINDOW_P (w) |
| 2208 | && (EQ (minibuf, Qlambda) | 2218 | && (EQ (minibuf, Qlambda) |
| @@ -2542,7 +2552,7 @@ enum window_loop | |||
| 2542 | GET_BUFFER_WINDOW, /* Arg is buffer */ | 2552 | GET_BUFFER_WINDOW, /* Arg is buffer */ |
| 2543 | REPLACE_BUFFER_IN_WINDOWS_SAFELY, /* Arg is buffer */ | 2553 | REPLACE_BUFFER_IN_WINDOWS_SAFELY, /* Arg is buffer */ |
| 2544 | REDISPLAY_BUFFER_WINDOWS, /* Arg is buffer */ | 2554 | REDISPLAY_BUFFER_WINDOWS, /* Arg is buffer */ |
| 2545 | CHECK_ALL_WINDOWS | 2555 | CHECK_ALL_WINDOWS /* Arg is ignored */ |
| 2546 | }; | 2556 | }; |
| 2547 | 2557 | ||
| 2548 | static Lisp_Object | 2558 | static Lisp_Object |
| @@ -2606,7 +2616,7 @@ window_loop (enum window_loop type, Lisp_Object obj, int mini, Lisp_Object frame | |||
| 2606 | switch (type) | 2616 | switch (type) |
| 2607 | { | 2617 | { |
| 2608 | case GET_BUFFER_WINDOW: | 2618 | case GET_BUFFER_WINDOW: |
| 2609 | if (EQ (w->buffer, obj) | 2619 | if (EQ (w->contents, obj) |
| 2610 | /* Don't find any minibuffer window except the one that | 2620 | /* Don't find any minibuffer window except the one that |
| 2611 | is currently in use. */ | 2621 | is currently in use. */ |
| 2612 | && (MINI_WINDOW_P (w) ? EQ (window, minibuf_window) : 1)) | 2622 | && (MINI_WINDOW_P (w) ? EQ (window, minibuf_window) : 1)) |
| @@ -2630,25 +2640,25 @@ window_loop (enum window_loop type, Lisp_Object obj, int mini, Lisp_Object frame | |||
| 2630 | case REPLACE_BUFFER_IN_WINDOWS_SAFELY: | 2640 | case REPLACE_BUFFER_IN_WINDOWS_SAFELY: |
| 2631 | /* We could simply check whether the buffer shown by window | 2641 | /* We could simply check whether the buffer shown by window |
| 2632 | is live, and show another buffer in case it isn't. */ | 2642 | is live, and show another buffer in case it isn't. */ |
| 2633 | if (EQ (w->buffer, obj)) | 2643 | if (EQ (w->contents, obj)) |
| 2634 | { | 2644 | { |
| 2635 | /* Undedicate WINDOW. */ | 2645 | /* Undedicate WINDOW. */ |
| 2636 | wset_dedicated (w, Qnil); | 2646 | wset_dedicated (w, Qnil); |
| 2637 | /* Make WINDOW show the buffer returned by | 2647 | /* Make WINDOW show the buffer returned by |
| 2638 | other_buffer_safely, don't run any hooks. */ | 2648 | other_buffer_safely, don't run any hooks. */ |
| 2639 | set_window_buffer | 2649 | set_window_buffer |
| 2640 | (window, other_buffer_safely (w->buffer), 0, 0); | 2650 | (window, other_buffer_safely (w->contents), 0, 0); |
| 2641 | /* If WINDOW is the selected window, make its buffer | 2651 | /* If WINDOW is the selected window, make its buffer |
| 2642 | current. But do so only if the window shows the | 2652 | current. But do so only if the window shows the |
| 2643 | current buffer (Bug#6454). */ | 2653 | current buffer (Bug#6454). */ |
| 2644 | if (EQ (window, selected_window) | 2654 | if (EQ (window, selected_window) |
| 2645 | && XBUFFER (w->buffer) == current_buffer) | 2655 | && XBUFFER (w->contents) == current_buffer) |
| 2646 | Fset_buffer (w->buffer); | 2656 | Fset_buffer (w->contents); |
| 2647 | } | 2657 | } |
| 2648 | break; | 2658 | break; |
| 2649 | 2659 | ||
| 2650 | case REDISPLAY_BUFFER_WINDOWS: | 2660 | case REDISPLAY_BUFFER_WINDOWS: |
| 2651 | if (EQ (w->buffer, obj)) | 2661 | if (EQ (w->contents, obj)) |
| 2652 | { | 2662 | { |
| 2653 | mark_window_display_accurate (window, 0); | 2663 | mark_window_display_accurate (window, 0); |
| 2654 | w->update_mode_line = 1; | 2664 | w->update_mode_line = 1; |
| @@ -2658,11 +2668,20 @@ window_loop (enum window_loop type, Lisp_Object obj, int mini, Lisp_Object frame | |||
| 2658 | } | 2668 | } |
| 2659 | break; | 2669 | break; |
| 2660 | 2670 | ||
| 2661 | /* Check for a window that has a killed buffer. */ | 2671 | /* Check for a leaf window that has a killed buffer |
| 2672 | or broken markers. */ | ||
| 2662 | case CHECK_ALL_WINDOWS: | 2673 | case CHECK_ALL_WINDOWS: |
| 2663 | if (! NILP (w->buffer) | 2674 | if (BUFFERP (w->contents)) |
| 2664 | && !BUFFER_LIVE_P (XBUFFER (w->buffer))) | 2675 | { |
| 2665 | emacs_abort (); | 2676 | struct buffer *b = XBUFFER (w->contents); |
| 2677 | |||
| 2678 | if (!BUFFER_LIVE_P (b)) | ||
| 2679 | emacs_abort (); | ||
| 2680 | if (!MARKERP (w->start) || XMARKER (w->start)->buffer != b) | ||
| 2681 | emacs_abort (); | ||
| 2682 | if (!MARKERP (w->pointm) || XMARKER (w->pointm)->buffer != b) | ||
| 2683 | emacs_abort (); | ||
| 2684 | } | ||
| 2666 | break; | 2685 | break; |
| 2667 | 2686 | ||
| 2668 | case WINDOW_LOOP_UNUSED: | 2687 | case WINDOW_LOOP_UNUSED: |
| @@ -2779,7 +2798,7 @@ window-start value is reasonable when this function is called. */) | |||
| 2779 | else if (MINI_WINDOW_P (w)) /* && top > 0) */ | 2798 | else if (MINI_WINDOW_P (w)) /* && top > 0) */ |
| 2780 | error ("Can't expand minibuffer to full frame"); | 2799 | error ("Can't expand minibuffer to full frame"); |
| 2781 | 2800 | ||
| 2782 | if (!NILP (w->buffer)) | 2801 | if (BUFFERP (w->contents)) |
| 2783 | { | 2802 | { |
| 2784 | startpos = marker_position (w->start); | 2803 | startpos = marker_position (w->start); |
| 2785 | startbyte = marker_byte_position (w->start); | 2804 | startbyte = marker_byte_position (w->start); |
| @@ -2851,12 +2870,11 @@ window-start value is reasonable when this function is called. */) | |||
| 2851 | FRAME_WINDOW_SIZES_CHANGED (f) = 1; | 2870 | FRAME_WINDOW_SIZES_CHANGED (f) = 1; |
| 2852 | resize_failed = 0; | 2871 | resize_failed = 0; |
| 2853 | 2872 | ||
| 2854 | if (NILP (w->buffer)) | 2873 | if (!WINDOW_LEAF_P (w)) |
| 2855 | { | 2874 | { |
| 2856 | /* Resize child windows vertically. */ | 2875 | /* Resize child windows vertically. */ |
| 2857 | XSETINT (delta, XINT (r->total_lines) | 2876 | XSETINT (delta, r->total_lines - w->total_lines); |
| 2858 | - XINT (w->total_lines)); | 2877 | w->top_line = r->top_line; |
| 2859 | wset_top_line (w, r->top_line); | ||
| 2860 | resize_root_window (window, delta, Qnil, Qnil); | 2878 | resize_root_window (window, delta, Qnil, Qnil); |
| 2861 | if (window_resize_check (w, 0)) | 2879 | if (window_resize_check (w, 0)) |
| 2862 | window_resize_apply (w, 0); | 2880 | window_resize_apply (w, 0); |
| @@ -2872,10 +2890,8 @@ window-start value is reasonable when this function is called. */) | |||
| 2872 | /* Resize child windows horizontally. */ | 2890 | /* Resize child windows horizontally. */ |
| 2873 | if (!resize_failed) | 2891 | if (!resize_failed) |
| 2874 | { | 2892 | { |
| 2875 | wset_left_col (w, r->left_col); | 2893 | w->left_col = r->left_col; |
| 2876 | XSETINT (delta, | 2894 | XSETINT (delta, r->total_cols - w->total_cols); |
| 2877 | XINT (r->total_cols) - XINT (w->total_cols)); | ||
| 2878 | wset_left_col (w, r->left_col); | ||
| 2879 | resize_root_window (window, delta, Qt, Qnil); | 2895 | resize_root_window (window, delta, Qt, Qnil); |
| 2880 | if (window_resize_check (w, 1)) | 2896 | if (window_resize_check (w, 1)) |
| 2881 | window_resize_apply (w, 1); | 2897 | window_resize_apply (w, 1); |
| @@ -2913,28 +2929,21 @@ window-start value is reasonable when this function is called. */) | |||
| 2913 | sibling = w->next; | 2929 | sibling = w->next; |
| 2914 | s = XWINDOW (sibling); | 2930 | s = XWINDOW (sibling); |
| 2915 | wset_prev (s, Qnil); | 2931 | wset_prev (s, Qnil); |
| 2916 | if (!NILP (XWINDOW (w->parent)->vchild)) | 2932 | wset_combination (XWINDOW (w->parent), |
| 2917 | wset_vchild (XWINDOW (w->parent), sibling); | 2933 | XWINDOW (w->parent)->horizontal, sibling); |
| 2918 | else | ||
| 2919 | wset_hchild (XWINDOW (w->parent), sibling); | ||
| 2920 | } | 2934 | } |
| 2921 | 2935 | ||
| 2922 | /* Delete ROOT and all child windows of ROOT. */ | 2936 | /* Delete ROOT and all child windows of ROOT. */ |
| 2923 | if (!NILP (r->vchild)) | 2937 | if (WINDOWP (r->contents)) |
| 2924 | { | ||
| 2925 | delete_all_child_windows (r->vchild); | ||
| 2926 | wset_vchild (r, Qnil); | ||
| 2927 | } | ||
| 2928 | else if (!NILP (r->hchild)) | ||
| 2929 | { | 2938 | { |
| 2930 | delete_all_child_windows (r->hchild); | 2939 | delete_all_child_windows (r->contents); |
| 2931 | wset_hchild (r, Qnil); | 2940 | wset_combination (r, 0, Qnil); |
| 2932 | } | 2941 | } |
| 2933 | 2942 | ||
| 2934 | replace_window (root, window, 1); | 2943 | replace_window (root, window, 1); |
| 2935 | 2944 | ||
| 2936 | /* This must become SWINDOW anyway ....... */ | 2945 | /* This must become SWINDOW anyway ....... */ |
| 2937 | if (!NILP (w->buffer) && !resize_failed) | 2946 | if (BUFFERP (w->contents) && !resize_failed) |
| 2938 | { | 2947 | { |
| 2939 | /* Try to minimize scrolling, by setting the window start to the | 2948 | /* Try to minimize scrolling, by setting the window start to the |
| 2940 | point will cause the text at the old window start to be at the | 2949 | point will cause the text at the old window start to be at the |
| @@ -2943,18 +2952,18 @@ window-start value is reasonable when this function is called. */) | |||
| 2943 | when the display is not current, due to typeahead). */ | 2952 | when the display is not current, due to typeahead). */ |
| 2944 | new_top = WINDOW_TOP_EDGE_LINE (w) - FRAME_TOP_MARGIN (XFRAME (WINDOW_FRAME (w))); | 2953 | new_top = WINDOW_TOP_EDGE_LINE (w) - FRAME_TOP_MARGIN (XFRAME (WINDOW_FRAME (w))); |
| 2945 | if (new_top != top | 2954 | if (new_top != top |
| 2946 | && startpos >= BUF_BEGV (XBUFFER (w->buffer)) | 2955 | && startpos >= BUF_BEGV (XBUFFER (w->contents)) |
| 2947 | && startpos <= BUF_ZV (XBUFFER (w->buffer))) | 2956 | && startpos <= BUF_ZV (XBUFFER (w->contents))) |
| 2948 | { | 2957 | { |
| 2949 | struct position pos; | 2958 | struct position pos; |
| 2950 | struct buffer *obuf = current_buffer; | 2959 | struct buffer *obuf = current_buffer; |
| 2951 | 2960 | ||
| 2952 | Fset_buffer (w->buffer); | 2961 | Fset_buffer (w->contents); |
| 2953 | /* This computation used to temporarily move point, but that | 2962 | /* This computation used to temporarily move point, but that |
| 2954 | can have unwanted side effects due to text properties. */ | 2963 | can have unwanted side effects due to text properties. */ |
| 2955 | pos = *vmotion (startpos, startbyte, -top, w); | 2964 | pos = *vmotion (startpos, startbyte, -top, w); |
| 2956 | 2965 | ||
| 2957 | set_marker_both (w->start, w->buffer, pos.bufpos, pos.bytepos); | 2966 | set_marker_both (w->start, w->contents, pos.bufpos, pos.bytepos); |
| 2958 | w->window_end_valid = 0; | 2967 | w->window_end_valid = 0; |
| 2959 | w->start_at_line_beg = (pos.bytepos == BEGV_BYTE | 2968 | w->start_at_line_beg = (pos.bytepos == BEGV_BYTE |
| 2960 | || FETCH_BYTE (pos.bytepos - 1) == '\n'); | 2969 | || FETCH_BYTE (pos.bytepos - 1) == '\n'); |
| @@ -3148,12 +3157,13 @@ If FRAME is omitted or nil, it defaults to the selected frame. */) | |||
| 3148 | reset from the buffer's local settings. */ | 3157 | reset from the buffer's local settings. */ |
| 3149 | 3158 | ||
| 3150 | void | 3159 | void |
| 3151 | set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int keep_margins_p) | 3160 | set_window_buffer (Lisp_Object window, Lisp_Object buffer, |
| 3161 | bool run_hooks_p, bool keep_margins_p) | ||
| 3152 | { | 3162 | { |
| 3153 | struct window *w = XWINDOW (window); | 3163 | struct window *w = XWINDOW (window); |
| 3154 | struct buffer *b = XBUFFER (buffer); | 3164 | struct buffer *b = XBUFFER (buffer); |
| 3155 | ptrdiff_t count = SPECPDL_INDEX (); | 3165 | ptrdiff_t count = SPECPDL_INDEX (); |
| 3156 | int samebuf = EQ (buffer, w->buffer); | 3166 | int samebuf = EQ (buffer, w->contents); |
| 3157 | 3167 | ||
| 3158 | wset_buffer (w, buffer); | 3168 | wset_buffer (w, buffer); |
| 3159 | 3169 | ||
| @@ -3272,7 +3282,7 @@ This function runs `window-scroll-functions' before running | |||
| 3272 | if (!BUFFER_LIVE_P (XBUFFER (buffer))) | 3282 | if (!BUFFER_LIVE_P (XBUFFER (buffer))) |
| 3273 | error ("Attempt to display deleted buffer"); | 3283 | error ("Attempt to display deleted buffer"); |
| 3274 | 3284 | ||
| 3275 | tem = w->buffer; | 3285 | tem = w->contents; |
| 3276 | if (NILP (tem)) | 3286 | if (NILP (tem)) |
| 3277 | error ("Window is deleted"); | 3287 | error ("Window is deleted"); |
| 3278 | else | 3288 | else |
| @@ -3325,8 +3335,8 @@ displaying that buffer. */) | |||
| 3325 | struct window *w = XWINDOW (object); | 3335 | struct window *w = XWINDOW (object); |
| 3326 | mark_window_display_accurate (object, 0); | 3336 | mark_window_display_accurate (object, 0); |
| 3327 | w->update_mode_line = 1; | 3337 | w->update_mode_line = 1; |
| 3328 | if (BUFFERP (w->buffer)) | 3338 | if (BUFFERP (w->contents)) |
| 3329 | XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1; | 3339 | XBUFFER (w->contents)->prevent_redisplay_optimizations_p = 1; |
| 3330 | ++update_mode_lines; | 3340 | ++update_mode_lines; |
| 3331 | return Qt; | 3341 | return Qt; |
| 3332 | } | 3342 | } |
| @@ -3395,7 +3405,7 @@ temp_output_buffer_show (register Lisp_Object buf) | |||
| 3395 | record_unwind_protect (Fset_buffer, prev_buffer); | 3405 | record_unwind_protect (Fset_buffer, prev_buffer); |
| 3396 | record_unwind_protect (select_window_norecord, prev_window); | 3406 | record_unwind_protect (select_window_norecord, prev_window); |
| 3397 | Fselect_window (window, Qt); | 3407 | Fselect_window (window, Qt); |
| 3398 | Fset_buffer (w->buffer); | 3408 | Fset_buffer (w->contents); |
| 3399 | Frun_hooks (1, &Qtemp_buffer_show_hook); | 3409 | Frun_hooks (1, &Qtemp_buffer_show_hook); |
| 3400 | unbind_to (count, Qnil); | 3410 | unbind_to (count, Qnil); |
| 3401 | } | 3411 | } |
| @@ -3406,7 +3416,7 @@ temp_output_buffer_show (register Lisp_Object buf) | |||
| 3406 | WINDOW its only vertical child (HORFLAG 1 means make WINDOW its only | 3416 | WINDOW its only vertical child (HORFLAG 1 means make WINDOW its only |
| 3407 | horizontal child). */ | 3417 | horizontal child). */ |
| 3408 | static void | 3418 | static void |
| 3409 | make_parent_window (Lisp_Object window, int horflag) | 3419 | make_parent_window (Lisp_Object window, bool horflag) |
| 3410 | { | 3420 | { |
| 3411 | Lisp_Object parent; | 3421 | Lisp_Object parent; |
| 3412 | register struct window *o, *p; | 3422 | register struct window *o, *p; |
| @@ -3416,7 +3426,7 @@ make_parent_window (Lisp_Object window, int horflag) | |||
| 3416 | memcpy ((char *) p + sizeof (struct vectorlike_header), | 3426 | memcpy ((char *) p + sizeof (struct vectorlike_header), |
| 3417 | (char *) o + sizeof (struct vectorlike_header), | 3427 | (char *) o + sizeof (struct vectorlike_header), |
| 3418 | word_size * VECSIZE (struct window)); | 3428 | word_size * VECSIZE (struct window)); |
| 3419 | /* P's buffer slot may change from nil to a buffer. */ | 3429 | /* P's buffer slot may change from nil to a buffer... */ |
| 3420 | adjust_window_count (p, 1); | 3430 | adjust_window_count (p, 1); |
| 3421 | XSETWINDOW (parent, p); | 3431 | XSETWINDOW (parent, p); |
| 3422 | 3432 | ||
| @@ -3425,12 +3435,11 @@ make_parent_window (Lisp_Object window, int horflag) | |||
| 3425 | wset_next (o, Qnil); | 3435 | wset_next (o, Qnil); |
| 3426 | wset_prev (o, Qnil); | 3436 | wset_prev (o, Qnil); |
| 3427 | wset_parent (o, parent); | 3437 | wset_parent (o, parent); |
| 3428 | 3438 | /* ...but now P becomes an internal window. */ | |
| 3429 | wset_hchild (p, horflag ? window : Qnil); | ||
| 3430 | wset_vchild (p, horflag ? Qnil : window); | ||
| 3431 | wset_start (p, Qnil); | 3439 | wset_start (p, Qnil); |
| 3432 | wset_pointm (p, Qnil); | 3440 | wset_pointm (p, Qnil); |
| 3433 | wset_buffer (p, Qnil); | 3441 | wset_buffer (p, Qnil); |
| 3442 | wset_combination (p, horflag, window); | ||
| 3434 | wset_combination_limit (p, Qnil); | 3443 | wset_combination_limit (p, Qnil); |
| 3435 | wset_window_parameters (p, Qnil); | 3444 | wset_window_parameters (p, Qnil); |
| 3436 | } | 3445 | } |
| @@ -3445,10 +3454,6 @@ make_window (void) | |||
| 3445 | w = allocate_window (); | 3454 | w = allocate_window (); |
| 3446 | /* Initialize Lisp data. Note that allocate_window initializes all | 3455 | /* Initialize Lisp data. Note that allocate_window initializes all |
| 3447 | Lisp data to nil, so do it only for slots which should not be nil. */ | 3456 | Lisp data to nil, so do it only for slots which should not be nil. */ |
| 3448 | wset_left_col (w, make_number (0)); | ||
| 3449 | wset_top_line (w, make_number (0)); | ||
| 3450 | wset_total_lines (w, make_number (0)); | ||
| 3451 | wset_total_cols (w, make_number (0)); | ||
| 3452 | wset_normal_lines (w, make_float (1.0)); | 3457 | wset_normal_lines (w, make_float (1.0)); |
| 3453 | wset_normal_cols (w, make_float (1.0)); | 3458 | wset_normal_cols (w, make_float (1.0)); |
| 3454 | wset_new_total (w, make_number (0)); | 3459 | wset_new_total (w, make_number (0)); |
| @@ -3519,14 +3524,14 @@ Note: This function does not operate on any child windows of WINDOW. */) | |||
| 3519 | `window-min-height' or `window-min-width'. It does check that window | 3524 | `window-min-height' or `window-min-width'. It does check that window |
| 3520 | sizes do not drop below one line (two columns). */ | 3525 | sizes do not drop below one line (two columns). */ |
| 3521 | static int | 3526 | static int |
| 3522 | window_resize_check (struct window *w, int horflag) | 3527 | window_resize_check (struct window *w, bool horflag) |
| 3523 | { | 3528 | { |
| 3524 | struct window *c; | 3529 | struct window *c; |
| 3525 | 3530 | ||
| 3526 | if (!NILP (w->vchild)) | 3531 | if (WINDOW_VERTICAL_COMBINATION_P (w)) |
| 3527 | /* W is a vertical combination. */ | 3532 | /* W is a vertical combination. */ |
| 3528 | { | 3533 | { |
| 3529 | c = XWINDOW (w->vchild); | 3534 | c = XWINDOW (w->contents); |
| 3530 | if (horflag) | 3535 | if (horflag) |
| 3531 | /* All child windows of W must have the same width as W. */ | 3536 | /* All child windows of W must have the same width as W. */ |
| 3532 | { | 3537 | { |
| @@ -3554,10 +3559,10 @@ window_resize_check (struct window *w, int horflag) | |||
| 3554 | return (sum_of_sizes == XINT (w->new_total)); | 3559 | return (sum_of_sizes == XINT (w->new_total)); |
| 3555 | } | 3560 | } |
| 3556 | } | 3561 | } |
| 3557 | else if (!NILP (w->hchild)) | 3562 | else if (WINDOW_HORIZONTAL_COMBINATION_P (w)) |
| 3558 | /* W is a horizontal combination. */ | 3563 | /* W is a horizontal combination. */ |
| 3559 | { | 3564 | { |
| 3560 | c = XWINDOW (w->hchild); | 3565 | c = XWINDOW (w->contents); |
| 3561 | if (horflag) | 3566 | if (horflag) |
| 3562 | /* The sum of the widths of the child windows of W must equal W's | 3567 | /* The sum of the widths of the child windows of W must equal W's |
| 3563 | width. */ | 3568 | width. */ |
| @@ -3600,7 +3605,7 @@ window_resize_check (struct window *w, int horflag) | |||
| 3600 | This function does not perform any error checks. Make sure you have | 3605 | This function does not perform any error checks. Make sure you have |
| 3601 | run window_resize_check on W before applying this function. */ | 3606 | run window_resize_check on W before applying this function. */ |
| 3602 | static void | 3607 | static void |
| 3603 | window_resize_apply (struct window *w, int horflag) | 3608 | window_resize_apply (struct window *w, bool horflag) |
| 3604 | { | 3609 | { |
| 3605 | struct window *c; | 3610 | struct window *c; |
| 3606 | int pos; | 3611 | int pos; |
| @@ -3609,50 +3614,50 @@ window_resize_apply (struct window *w, int horflag) | |||
| 3609 | parent window has been set *before*. */ | 3614 | parent window has been set *before*. */ |
| 3610 | if (horflag) | 3615 | if (horflag) |
| 3611 | { | 3616 | { |
| 3612 | wset_total_cols (w, w->new_total); | 3617 | w->total_cols = XFASTINT (w->new_total); |
| 3613 | if (NUMBERP (w->new_normal)) | 3618 | if (NUMBERP (w->new_normal)) |
| 3614 | wset_normal_cols (w, w->new_normal); | 3619 | wset_normal_cols (w, w->new_normal); |
| 3615 | 3620 | ||
| 3616 | pos = XINT (w->left_col); | 3621 | pos = w->left_col; |
| 3617 | } | 3622 | } |
| 3618 | else | 3623 | else |
| 3619 | { | 3624 | { |
| 3620 | wset_total_lines (w, w->new_total); | 3625 | w->total_lines = XFASTINT (w->new_total); |
| 3621 | if (NUMBERP (w->new_normal)) | 3626 | if (NUMBERP (w->new_normal)) |
| 3622 | wset_normal_lines (w, w->new_normal); | 3627 | wset_normal_lines (w, w->new_normal); |
| 3623 | 3628 | ||
| 3624 | pos = XINT (w->top_line); | 3629 | pos = w->top_line; |
| 3625 | } | 3630 | } |
| 3626 | 3631 | ||
| 3627 | if (!NILP (w->vchild)) | 3632 | if (WINDOW_VERTICAL_COMBINATION_P (w)) |
| 3628 | /* W is a vertical combination. */ | 3633 | /* W is a vertical combination. */ |
| 3629 | { | 3634 | { |
| 3630 | c = XWINDOW (w->vchild); | 3635 | c = XWINDOW (w->contents); |
| 3631 | while (c) | 3636 | while (c) |
| 3632 | { | 3637 | { |
| 3633 | if (horflag) | 3638 | if (horflag) |
| 3634 | wset_left_col (c, make_number (pos)); | 3639 | c->left_col = pos; |
| 3635 | else | 3640 | else |
| 3636 | wset_top_line (c, make_number (pos)); | 3641 | c->top_line = pos; |
| 3637 | window_resize_apply (c, horflag); | 3642 | window_resize_apply (c, horflag); |
| 3638 | if (!horflag) | 3643 | if (!horflag) |
| 3639 | pos = pos + XINT (c->total_lines); | 3644 | pos = pos + c->total_lines; |
| 3640 | c = NILP (c->next) ? 0 : XWINDOW (c->next); | 3645 | c = NILP (c->next) ? 0 : XWINDOW (c->next); |
| 3641 | } | 3646 | } |
| 3642 | } | 3647 | } |
| 3643 | else if (!NILP (w->hchild)) | 3648 | else if (WINDOW_HORIZONTAL_COMBINATION_P (w)) |
| 3644 | /* W is a horizontal combination. */ | 3649 | /* W is a horizontal combination. */ |
| 3645 | { | 3650 | { |
| 3646 | c = XWINDOW (w->hchild); | 3651 | c = XWINDOW (w->contents); |
| 3647 | while (c) | 3652 | while (c) |
| 3648 | { | 3653 | { |
| 3649 | if (horflag) | 3654 | if (horflag) |
| 3650 | wset_left_col (c, make_number (pos)); | 3655 | c->left_col = pos; |
| 3651 | else | 3656 | else |
| 3652 | wset_top_line (c, make_number (pos)); | 3657 | c->top_line = pos; |
| 3653 | window_resize_apply (c, horflag); | 3658 | window_resize_apply (c, horflag); |
| 3654 | if (horflag) | 3659 | if (horflag) |
| 3655 | pos = pos + XINT (c->total_cols); | 3660 | pos = pos + c->total_cols; |
| 3656 | c = NILP (c->next) ? 0 : XWINDOW (c->next); | 3661 | c = NILP (c->next) ? 0 : XWINDOW (c->next); |
| 3657 | } | 3662 | } |
| 3658 | } | 3663 | } |
| @@ -3681,11 +3686,11 @@ be applied on the Elisp level. */) | |||
| 3681 | { | 3686 | { |
| 3682 | struct frame *f = decode_live_frame (frame); | 3687 | struct frame *f = decode_live_frame (frame); |
| 3683 | struct window *r = XWINDOW (FRAME_ROOT_WINDOW (f)); | 3688 | struct window *r = XWINDOW (FRAME_ROOT_WINDOW (f)); |
| 3684 | int horflag = !NILP (horizontal); | 3689 | bool horflag = !NILP (horizontal); |
| 3685 | 3690 | ||
| 3686 | if (!window_resize_check (r, horflag) | 3691 | if (!window_resize_check (r, horflag) |
| 3687 | || ! EQ (r->new_total, | 3692 | || (XINT (r->new_total) |
| 3688 | (horflag ? r->total_cols : r->total_lines))) | 3693 | != (horflag ? r->total_cols : r->total_lines))) |
| 3689 | return Qnil; | 3694 | return Qnil; |
| 3690 | 3695 | ||
| 3691 | block_input (); | 3696 | block_input (); |
| @@ -3711,7 +3716,7 @@ be applied on the Elisp level. */) | |||
| 3711 | satisfy the request. The result will be meaningful if and only if | 3716 | satisfy the request. The result will be meaningful if and only if |
| 3712 | F's windows have meaningful sizes when you call this. */ | 3717 | F's windows have meaningful sizes when you call this. */ |
| 3713 | void | 3718 | void |
| 3714 | resize_frame_windows (struct frame *f, int size, int horflag) | 3719 | resize_frame_windows (struct frame *f, int size, bool horflag) |
| 3715 | { | 3720 | { |
| 3716 | Lisp_Object root = f->root_window; | 3721 | Lisp_Object root = f->root_window; |
| 3717 | struct window *r = XWINDOW (root); | 3722 | struct window *r = XWINDOW (root); |
| @@ -3725,18 +3730,17 @@ resize_frame_windows (struct frame *f, int size, int horflag) | |||
| 3725 | - ((FRAME_HAS_MINIBUF_P (f) && !FRAME_MINIBUF_ONLY_P (f)) | 3730 | - ((FRAME_HAS_MINIBUF_P (f) && !FRAME_MINIBUF_ONLY_P (f)) |
| 3726 | ? 1 : 0))); | 3731 | ? 1 : 0))); |
| 3727 | 3732 | ||
| 3728 | wset_top_line (r, make_number (FRAME_TOP_MARGIN (f))); | 3733 | r->top_line = FRAME_TOP_MARGIN (f); |
| 3729 | if (NILP (r->vchild) && NILP (r->hchild)) | 3734 | if (WINDOW_LEAF_P (r)) |
| 3730 | /* For a leaf root window just set the size. */ | 3735 | /* For a leaf root window just set the size. */ |
| 3731 | if (horflag) | 3736 | if (horflag) |
| 3732 | wset_total_cols (r, make_number (new_size)); | 3737 | r->total_cols = new_size; |
| 3733 | else | 3738 | else |
| 3734 | wset_total_lines (r, make_number (new_size)); | 3739 | r->total_lines = new_size; |
| 3735 | else | 3740 | else |
| 3736 | { | 3741 | { |
| 3737 | /* old_size is the old size of the frame's root window. */ | 3742 | /* old_size is the old size of the frame's root window. */ |
| 3738 | int old_size = XFASTINT (horflag ? r->total_cols | 3743 | int old_size = horflag ? r->total_cols : r->total_lines; |
| 3739 | : r->total_lines); | ||
| 3740 | Lisp_Object delta; | 3744 | Lisp_Object delta; |
| 3741 | 3745 | ||
| 3742 | XSETINT (delta, new_size - old_size); | 3746 | XSETINT (delta, new_size - old_size); |
| @@ -3766,9 +3770,9 @@ resize_frame_windows (struct frame *f, int size, int horflag) | |||
| 3766 | root = f->selected_window; | 3770 | root = f->selected_window; |
| 3767 | Fdelete_other_windows_internal (root, Qnil); | 3771 | Fdelete_other_windows_internal (root, Qnil); |
| 3768 | if (horflag) | 3772 | if (horflag) |
| 3769 | wset_total_cols (XWINDOW (root), make_number (new_size)); | 3773 | XWINDOW (root)->total_cols = new_size; |
| 3770 | else | 3774 | else |
| 3771 | wset_total_lines (XWINDOW (root), make_number (new_size)); | 3775 | XWINDOW (root)->total_lines = new_size; |
| 3772 | } | 3776 | } |
| 3773 | } | 3777 | } |
| 3774 | } | 3778 | } |
| @@ -3778,13 +3782,12 @@ resize_frame_windows (struct frame *f, int size, int horflag) | |||
| 3778 | { | 3782 | { |
| 3779 | m = XWINDOW (mini); | 3783 | m = XWINDOW (mini); |
| 3780 | if (horflag) | 3784 | if (horflag) |
| 3781 | wset_total_cols (m, make_number (size)); | 3785 | m->total_cols = size; |
| 3782 | else | 3786 | else |
| 3783 | { | 3787 | { |
| 3784 | /* Are we sure we always want 1 line here? */ | 3788 | /* Are we sure we always want 1 line here? */ |
| 3785 | wset_total_lines (m, make_number (1)); | 3789 | m->total_lines = 1; |
| 3786 | wset_top_line | 3790 | m->top_line = r->top_line + r->total_lines; |
| 3787 | (m, make_number (XINT (r->top_line) + XINT (r->total_lines))); | ||
| 3788 | } | 3791 | } |
| 3789 | } | 3792 | } |
| 3790 | 3793 | ||
| @@ -3825,7 +3828,7 @@ set correctly. See the code of `split-window' for how this is done. */) | |||
| 3825 | register Lisp_Object new, frame, reference; | 3828 | register Lisp_Object new, frame, reference; |
| 3826 | register struct window *o, *p, *n, *r; | 3829 | register struct window *o, *p, *n, *r; |
| 3827 | struct frame *f; | 3830 | struct frame *f; |
| 3828 | int horflag | 3831 | bool horflag |
| 3829 | /* HORFLAG is 1 when we split side-by-side, 0 otherwise. */ | 3832 | /* HORFLAG is 1 when we split side-by-side, 0 otherwise. */ |
| 3830 | = EQ (side, Qt) || EQ (side, Qleft) || EQ (side, Qright); | 3833 | = EQ (side, Qt) || EQ (side, Qleft) || EQ (side, Qright); |
| 3831 | int combination_limit = 0; | 3834 | int combination_limit = 0; |
| @@ -3843,9 +3846,9 @@ set correctly. See the code of `split-window' for how this is done. */) | |||
| 3843 | combination_limit = | 3846 | combination_limit = |
| 3844 | EQ (Vwindow_combination_limit, Qt) | 3847 | EQ (Vwindow_combination_limit, Qt) |
| 3845 | || NILP (o->parent) | 3848 | || NILP (o->parent) |
| 3846 | || NILP (horflag | 3849 | || (horflag |
| 3847 | ? (XWINDOW (o->parent)->hchild) | 3850 | ? WINDOW_VERTICAL_COMBINATION_P (XWINDOW (o->parent)) |
| 3848 | : (XWINDOW (o->parent)->vchild)); | 3851 | : WINDOW_HORIZONTAL_COMBINATION_P (XWINDOW (o->parent))); |
| 3849 | 3852 | ||
| 3850 | /* We need a live reference window to initialize some parameters. */ | 3853 | /* We need a live reference window to initialize some parameters. */ |
| 3851 | if (WINDOW_LIVE_P (old)) | 3854 | if (WINDOW_LIVE_P (old)) |
| @@ -3868,20 +3871,21 @@ set correctly. See the code of `split-window' for how this is done. */) | |||
| 3868 | p = XWINDOW (o->parent); | 3871 | p = XWINDOW (o->parent); |
| 3869 | /* Temporarily pretend we split the parent window. */ | 3872 | /* Temporarily pretend we split the parent window. */ |
| 3870 | wset_new_total | 3873 | wset_new_total |
| 3871 | (p, make_number (XINT (horflag ? p->total_cols : p->total_lines) | 3874 | (p, make_number ((horflag ? p->total_cols : p->total_lines) |
| 3872 | - XINT (total_size))); | 3875 | - XINT (total_size))); |
| 3873 | if (!window_resize_check (p, horflag)) | 3876 | if (!window_resize_check (p, horflag)) |
| 3874 | error ("Window sizes don't fit"); | 3877 | error ("Window sizes don't fit"); |
| 3875 | else | 3878 | else |
| 3876 | /* Undo the temporary pretension. */ | 3879 | /* Undo the temporary pretension. */ |
| 3877 | wset_new_total (p, horflag ? p->total_cols : p->total_lines); | 3880 | wset_new_total (p, make_number |
| 3881 | (horflag ? p->total_cols : p->total_lines)); | ||
| 3878 | } | 3882 | } |
| 3879 | else | 3883 | else |
| 3880 | { | 3884 | { |
| 3881 | if (!window_resize_check (o, horflag)) | 3885 | if (!window_resize_check (o, horflag)) |
| 3882 | error ("Resizing old window failed"); | 3886 | error ("Resizing old window failed"); |
| 3883 | else if (XINT (total_size) + XINT (o->new_total) | 3887 | else if (XINT (total_size) + XINT (o->new_total) |
| 3884 | != XINT (horflag ? o->total_cols : o->total_lines)) | 3888 | != (horflag ? o->total_cols : o->total_lines)) |
| 3885 | error ("Sum of sizes of old and new window don't fit"); | 3889 | error ("Sum of sizes of old and new window don't fit"); |
| 3886 | } | 3890 | } |
| 3887 | 3891 | ||
| @@ -3901,7 +3905,8 @@ set correctly. See the code of `split-window' for how this is done. */) | |||
| 3901 | that its children get merged into another window. */ | 3905 | that its children get merged into another window. */ |
| 3902 | wset_combination_limit (p, Qt); | 3906 | wset_combination_limit (p, Qt); |
| 3903 | /* These get applied below. */ | 3907 | /* These get applied below. */ |
| 3904 | wset_new_total (p, horflag ? o->total_cols : o->total_lines); | 3908 | wset_new_total (p, make_number |
| 3909 | (horflag ? o->total_cols : o->total_lines)); | ||
| 3905 | wset_new_normal (p, new_normal); | 3910 | wset_new_normal (p, new_normal); |
| 3906 | } | 3911 | } |
| 3907 | else | 3912 | else |
| @@ -3913,17 +3918,12 @@ set correctly. See the code of `split-window' for how this is done. */) | |||
| 3913 | n = XWINDOW (new); | 3918 | n = XWINDOW (new); |
| 3914 | wset_frame (n, frame); | 3919 | wset_frame (n, frame); |
| 3915 | wset_parent (n, o->parent); | 3920 | wset_parent (n, o->parent); |
| 3916 | wset_vchild (n, Qnil); | ||
| 3917 | wset_hchild (n, Qnil); | ||
| 3918 | 3921 | ||
| 3919 | if (EQ (side, Qabove) || EQ (side, Qleft)) | 3922 | if (EQ (side, Qabove) || EQ (side, Qleft)) |
| 3920 | { | 3923 | { |
| 3921 | wset_prev (n, o->prev); | 3924 | wset_prev (n, o->prev); |
| 3922 | if (NILP (n->prev)) | 3925 | if (NILP (n->prev)) |
| 3923 | if (horflag) | 3926 | wset_combination (p, horflag, new); |
| 3924 | wset_hchild (p, new); | ||
| 3925 | else | ||
| 3926 | wset_vchild (p, new); | ||
| 3927 | else | 3927 | else |
| 3928 | wset_next (XWINDOW (n->prev), new); | 3928 | wset_next (XWINDOW (n->prev), new); |
| 3929 | wset_next (n, old); | 3929 | wset_next (n, old); |
| @@ -3953,13 +3953,13 @@ set correctly. See the code of `split-window' for how this is done. */) | |||
| 3953 | /* Directly assign orthogonal coordinates and sizes. */ | 3953 | /* Directly assign orthogonal coordinates and sizes. */ |
| 3954 | if (horflag) | 3954 | if (horflag) |
| 3955 | { | 3955 | { |
| 3956 | wset_top_line (n, o->top_line); | 3956 | n->top_line = o->top_line; |
| 3957 | wset_total_lines (n, o->total_lines); | 3957 | n->total_lines = o->total_lines; |
| 3958 | } | 3958 | } |
| 3959 | else | 3959 | else |
| 3960 | { | 3960 | { |
| 3961 | wset_left_col (n, o->left_col); | 3961 | n->left_col = o->left_col; |
| 3962 | wset_total_cols (n, o->total_cols); | 3962 | n->total_cols = o->total_cols; |
| 3963 | } | 3963 | } |
| 3964 | 3964 | ||
| 3965 | /* Iso-coordinates and sizes are assigned by window_resize_apply, | 3965 | /* Iso-coordinates and sizes are assigned by window_resize_apply, |
| @@ -3972,7 +3972,7 @@ set correctly. See the code of `split-window' for how this is done. */) | |||
| 3972 | adjust_glyphs (f); | 3972 | adjust_glyphs (f); |
| 3973 | /* Set buffer of NEW to buffer of reference window. Don't run | 3973 | /* Set buffer of NEW to buffer of reference window. Don't run |
| 3974 | any hooks. */ | 3974 | any hooks. */ |
| 3975 | set_window_buffer (new, r->buffer, 0, 1); | 3975 | set_window_buffer (new, r->contents, 0, 1); |
| 3976 | unblock_input (); | 3976 | unblock_input (); |
| 3977 | 3977 | ||
| 3978 | /* Maybe we should run the scroll functions in Elisp (which already | 3978 | /* Maybe we should run the scroll functions in Elisp (which already |
| @@ -3994,13 +3994,11 @@ Signal an error when WINDOW is the only window on its frame. */) | |||
| 3994 | register Lisp_Object parent, sibling, frame, root; | 3994 | register Lisp_Object parent, sibling, frame, root; |
| 3995 | struct window *w, *p, *s, *r; | 3995 | struct window *w, *p, *s, *r; |
| 3996 | struct frame *f; | 3996 | struct frame *f; |
| 3997 | int horflag; | 3997 | bool horflag, before_sibling = 0; |
| 3998 | int before_sibling = 0; | ||
| 3999 | 3998 | ||
| 4000 | w = decode_any_window (window); | 3999 | w = decode_any_window (window); |
| 4001 | XSETWINDOW (window, w); | 4000 | XSETWINDOW (window, w); |
| 4002 | if (NILP (w->buffer) | 4001 | if (NILP (w->contents)) |
| 4003 | && NILP (w->hchild) && NILP (w->vchild)) | ||
| 4004 | /* It's a no-op to delete an already deleted window. */ | 4002 | /* It's a no-op to delete an already deleted window. */ |
| 4005 | return Qnil; | 4003 | return Qnil; |
| 4006 | 4004 | ||
| @@ -4014,7 +4012,7 @@ Signal an error when WINDOW is the only window on its frame. */) | |||
| 4014 | error ("Attempt to delete sole window of parent"); | 4012 | error ("Attempt to delete sole window of parent"); |
| 4015 | 4013 | ||
| 4016 | p = XWINDOW (parent); | 4014 | p = XWINDOW (parent); |
| 4017 | horflag = NILP (p->vchild); | 4015 | horflag = WINDOW_HORIZONTAL_COMBINATION_P (p); |
| 4018 | 4016 | ||
| 4019 | frame = WINDOW_FRAME (w); | 4017 | frame = WINDOW_FRAME (w); |
| 4020 | f = XFRAME (frame); | 4018 | f = XFRAME (frame); |
| @@ -4032,10 +4030,7 @@ Signal an error when WINDOW is the only window on its frame. */) | |||
| 4032 | sibling = w->next; | 4030 | sibling = w->next; |
| 4033 | s = XWINDOW (sibling); | 4031 | s = XWINDOW (sibling); |
| 4034 | wset_prev (s, Qnil); | 4032 | wset_prev (s, Qnil); |
| 4035 | if (horflag) | 4033 | wset_combination (p, horflag, sibling); |
| 4036 | wset_hchild (p, sibling); | ||
| 4037 | else | ||
| 4038 | wset_vchild (p, sibling); | ||
| 4039 | } | 4034 | } |
| 4040 | else | 4035 | else |
| 4041 | /* Get SIBLING above (on the left of) WINDOW. */ | 4036 | /* Get SIBLING above (on the left of) WINDOW. */ |
| @@ -4048,8 +4043,8 @@ Signal an error when WINDOW is the only window on its frame. */) | |||
| 4048 | } | 4043 | } |
| 4049 | 4044 | ||
| 4050 | if (window_resize_check (r, horflag) | 4045 | if (window_resize_check (r, horflag) |
| 4051 | && EQ (r->new_total, | 4046 | && (XINT (r->new_total) |
| 4052 | (horflag ? r->total_cols : r->total_lines))) | 4047 | == (horflag ? r->total_cols : r->total_lines))) |
| 4053 | /* We can delete WINDOW now. */ | 4048 | /* We can delete WINDOW now. */ |
| 4054 | { | 4049 | { |
| 4055 | 4050 | ||
| @@ -4074,17 +4069,12 @@ Signal an error when WINDOW is the only window on its frame. */) | |||
| 4074 | wset_next (w, Qnil); /* Don't delete w->next too. */ | 4069 | wset_next (w, Qnil); /* Don't delete w->next too. */ |
| 4075 | free_window_matrices (w); | 4070 | free_window_matrices (w); |
| 4076 | 4071 | ||
| 4077 | if (!NILP (w->vchild)) | 4072 | if (WINDOWP (w->contents)) |
| 4078 | { | 4073 | { |
| 4079 | delete_all_child_windows (w->vchild); | 4074 | delete_all_child_windows (w->contents); |
| 4080 | wset_vchild (w, Qnil); | 4075 | wset_combination (w, 0, Qnil); |
| 4081 | } | 4076 | } |
| 4082 | else if (!NILP (w->hchild)) | 4077 | else |
| 4083 | { | ||
| 4084 | delete_all_child_windows (w->hchild); | ||
| 4085 | wset_hchild (w, Qnil); | ||
| 4086 | } | ||
| 4087 | else if (!NILP (w->buffer)) | ||
| 4088 | { | 4078 | { |
| 4089 | unshow_buffer (w); | 4079 | unshow_buffer (w); |
| 4090 | unchain_marker (XMARKER (w->pointm)); | 4080 | unchain_marker (XMARKER (w->pointm)); |
| @@ -4103,8 +4093,7 @@ Signal an error when WINDOW is the only window on its frame. */) | |||
| 4103 | wset_normal_cols (s, p->normal_cols); | 4093 | wset_normal_cols (s, p->normal_cols); |
| 4104 | wset_normal_lines (s, p->normal_lines); | 4094 | wset_normal_lines (s, p->normal_lines); |
| 4105 | /* Mark PARENT as deleted. */ | 4095 | /* Mark PARENT as deleted. */ |
| 4106 | wset_vchild (p, Qnil); | 4096 | wset_combination (p, 0, Qnil); |
| 4107 | wset_hchild (p, Qnil); | ||
| 4108 | /* Try to merge SIBLING into its new parent. */ | 4097 | /* Try to merge SIBLING into its new parent. */ |
| 4109 | recombine_windows (sibling); | 4098 | recombine_windows (sibling); |
| 4110 | } | 4099 | } |
| @@ -4152,10 +4141,7 @@ Signal an error when WINDOW is the only window on its frame. */) | |||
| 4152 | if (before_sibling) | 4141 | if (before_sibling) |
| 4153 | { | 4142 | { |
| 4154 | wset_prev (s, window); | 4143 | wset_prev (s, window); |
| 4155 | if (horflag) | 4144 | wset_combination (p, horflag, window); |
| 4156 | wset_hchild (p, window); | ||
| 4157 | else | ||
| 4158 | wset_vchild (p, window); | ||
| 4159 | } | 4145 | } |
| 4160 | else | 4146 | else |
| 4161 | { | 4147 | { |
| @@ -4195,10 +4181,8 @@ grow_mini_window (struct window *w, int delta) | |||
| 4195 | window_resize_apply (r, 0); | 4181 | window_resize_apply (r, 0); |
| 4196 | 4182 | ||
| 4197 | /* Grow the mini-window. */ | 4183 | /* Grow the mini-window. */ |
| 4198 | wset_top_line | 4184 | w->top_line = r->top_line + r->total_lines; |
| 4199 | (w, make_number (XFASTINT (r->top_line) + XFASTINT (r->total_lines))); | 4185 | w->total_lines -= XINT (value); |
| 4200 | wset_total_lines | ||
| 4201 | (w, make_number (XFASTINT (w->total_lines) - XINT (value))); | ||
| 4202 | w->last_modified = 0; | 4186 | w->last_modified = 0; |
| 4203 | w->last_overlay_modified = 0; | 4187 | w->last_overlay_modified = 0; |
| 4204 | 4188 | ||
| @@ -4220,7 +4204,7 @@ shrink_mini_window (struct window *w) | |||
| 4220 | 4204 | ||
| 4221 | eassert (MINI_WINDOW_P (w)); | 4205 | eassert (MINI_WINDOW_P (w)); |
| 4222 | 4206 | ||
| 4223 | size = XINT (w->total_lines); | 4207 | size = w->total_lines; |
| 4224 | if (size > 1) | 4208 | if (size > 1) |
| 4225 | { | 4209 | { |
| 4226 | root = FRAME_ROOT_WINDOW (f); | 4210 | root = FRAME_ROOT_WINDOW (f); |
| @@ -4233,9 +4217,8 @@ shrink_mini_window (struct window *w) | |||
| 4233 | window_resize_apply (r, 0); | 4217 | window_resize_apply (r, 0); |
| 4234 | 4218 | ||
| 4235 | /* Shrink the mini-window. */ | 4219 | /* Shrink the mini-window. */ |
| 4236 | wset_top_line (w, make_number (XFASTINT (r->top_line) | 4220 | w->top_line = r->top_line + r->total_lines; |
| 4237 | + XFASTINT (r->total_lines))); | 4221 | w->total_lines = 1; |
| 4238 | wset_total_lines (w, make_number (1)); | ||
| 4239 | 4222 | ||
| 4240 | w->last_modified = 0; | 4223 | w->last_modified = 0; |
| 4241 | w->last_overlay_modified = 0; | 4224 | w->last_overlay_modified = 0; |
| @@ -4269,7 +4252,7 @@ DEFUN ("resize-mini-window-internal", Fresize_mini_window_internal, Sresize_mini | |||
| 4269 | error ("Cannot resize a minibuffer-only frame"); | 4252 | error ("Cannot resize a minibuffer-only frame"); |
| 4270 | 4253 | ||
| 4271 | r = XWINDOW (FRAME_ROOT_WINDOW (f)); | 4254 | r = XWINDOW (FRAME_ROOT_WINDOW (f)); |
| 4272 | height = XINT (r->total_lines) + XINT (w->total_lines); | 4255 | height = r->total_lines + w->total_lines; |
| 4273 | if (window_resize_check (r, 0) | 4256 | if (window_resize_check (r, 0) |
| 4274 | && XINT (w->new_total) > 0 | 4257 | && XINT (w->new_total) > 0 |
| 4275 | && height == XINT (r->new_total) + XINT (w->new_total)) | 4258 | && height == XINT (r->new_total) + XINT (w->new_total)) |
| @@ -4277,9 +4260,8 @@ DEFUN ("resize-mini-window-internal", Fresize_mini_window_internal, Sresize_mini | |||
| 4277 | block_input (); | 4260 | block_input (); |
| 4278 | window_resize_apply (r, 0); | 4261 | window_resize_apply (r, 0); |
| 4279 | 4262 | ||
| 4280 | wset_total_lines (w, w->new_total); | 4263 | w->total_lines = XFASTINT (w->new_total); |
| 4281 | wset_top_line (w, make_number (XINT (r->top_line) | 4264 | w->top_line = r->top_line + r->total_lines; |
| 4282 | + XINT (r->total_lines))); | ||
| 4283 | 4265 | ||
| 4284 | windows_or_buffers_changed++; | 4266 | windows_or_buffers_changed++; |
| 4285 | FRAME_WINDOW_SIZES_CHANGED (f) = 1; | 4267 | FRAME_WINDOW_SIZES_CHANGED (f) = 1; |
| @@ -4302,10 +4284,8 @@ mark_window_cursors_off (struct window *w) | |||
| 4302 | { | 4284 | { |
| 4303 | while (w) | 4285 | while (w) |
| 4304 | { | 4286 | { |
| 4305 | if (!NILP (w->hchild)) | 4287 | if (WINDOWP (w->contents)) |
| 4306 | mark_window_cursors_off (XWINDOW (w->hchild)); | 4288 | mark_window_cursors_off (XWINDOW (w->contents)); |
| 4307 | else if (!NILP (w->vchild)) | ||
| 4308 | mark_window_cursors_off (XWINDOW (w->vchild)); | ||
| 4309 | else | 4289 | else |
| 4310 | w->phys_cursor_on_p = 0; | 4290 | w->phys_cursor_on_p = 0; |
| 4311 | 4291 | ||
| @@ -4319,13 +4299,12 @@ mark_window_cursors_off (struct window *w) | |||
| 4319 | int | 4299 | int |
| 4320 | window_internal_height (struct window *w) | 4300 | window_internal_height (struct window *w) |
| 4321 | { | 4301 | { |
| 4322 | int ht = XFASTINT (w->total_lines); | 4302 | int ht = w->total_lines; |
| 4323 | 4303 | ||
| 4324 | if (!MINI_WINDOW_P (w)) | 4304 | if (!MINI_WINDOW_P (w)) |
| 4325 | { | 4305 | { |
| 4326 | if (!NILP (w->parent) | 4306 | if (!NILP (w->parent) |
| 4327 | || !NILP (w->vchild) | 4307 | || WINDOWP (w->contents) |
| 4328 | || !NILP (w->hchild) | ||
| 4329 | || !NILP (w->next) | 4308 | || !NILP (w->next) |
| 4330 | || !NILP (w->prev) | 4309 | || !NILP (w->prev) |
| 4331 | || WINDOW_WANTS_MODELINE_P (w)) | 4310 | || WINDOW_WANTS_MODELINE_P (w)) |
| @@ -4464,7 +4443,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror) | |||
| 4464 | else | 4443 | else |
| 4465 | spos = min (XINT (Fline_end_position (Qnil)) + 1, ZV); | 4444 | spos = min (XINT (Fline_end_position (Qnil)) + 1, ZV); |
| 4466 | set_marker_restricted (w->start, make_number (spos), | 4445 | set_marker_restricted (w->start, make_number (spos), |
| 4467 | w->buffer); | 4446 | w->contents); |
| 4468 | w->start_at_line_beg = 1; | 4447 | w->start_at_line_beg = 1; |
| 4469 | w->update_mode_line = 1; | 4448 | w->update_mode_line = 1; |
| 4470 | w->last_modified = 0; | 4449 | w->last_modified = 0; |
| @@ -4588,7 +4567,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror) | |||
| 4588 | 4567 | ||
| 4589 | /* If control gets here, then we vscrolled. */ | 4568 | /* If control gets here, then we vscrolled. */ |
| 4590 | 4569 | ||
| 4591 | XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1; | 4570 | XBUFFER (w->contents)->prevent_redisplay_optimizations_p = 1; |
| 4592 | 4571 | ||
| 4593 | /* Don't try to change the window start below. */ | 4572 | /* Don't try to change the window start below. */ |
| 4594 | vscrolled = 1; | 4573 | vscrolled = 1; |
| @@ -4608,7 +4587,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror) | |||
| 4608 | } | 4587 | } |
| 4609 | 4588 | ||
| 4610 | /* Set the window start, and set up the window for redisplay. */ | 4589 | /* Set the window start, and set up the window for redisplay. */ |
| 4611 | set_marker_restricted_both (w->start, w->buffer, IT_CHARPOS (it), | 4590 | set_marker_restricted_both (w->start, w->contents, IT_CHARPOS (it), |
| 4612 | IT_BYTEPOS (it)); | 4591 | IT_BYTEPOS (it)); |
| 4613 | bytepos = marker_byte_position (w->start); | 4592 | bytepos = marker_byte_position (w->start); |
| 4614 | w->start_at_line_beg = (pos == BEGV || FETCH_BYTE (bytepos - 1) == '\n'); | 4593 | w->start_at_line_beg = (pos == BEGV || FETCH_BYTE (bytepos - 1) == '\n'); |
| @@ -4629,7 +4608,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror) | |||
| 4629 | even if there is a header line. */ | 4608 | even if there is a header line. */ |
| 4630 | this_scroll_margin = max (0, scroll_margin); | 4609 | this_scroll_margin = max (0, scroll_margin); |
| 4631 | this_scroll_margin | 4610 | this_scroll_margin |
| 4632 | = min (this_scroll_margin, XFASTINT (w->total_lines) / 4); | 4611 | = min (this_scroll_margin, w->total_lines / 4); |
| 4633 | this_scroll_margin *= FRAME_LINE_HEIGHT (it.f); | 4612 | this_scroll_margin *= FRAME_LINE_HEIGHT (it.f); |
| 4634 | 4613 | ||
| 4635 | if (n > 0) | 4614 | if (n > 0) |
| @@ -4806,9 +4785,9 @@ window_scroll_line_based (Lisp_Object window, int n, int whole, int noerror) | |||
| 4806 | { | 4785 | { |
| 4807 | /* Don't use a scroll margin that is negative or too large. */ | 4786 | /* Don't use a scroll margin that is negative or too large. */ |
| 4808 | int this_scroll_margin = | 4787 | int this_scroll_margin = |
| 4809 | max (0, min (scroll_margin, XINT (w->total_lines) / 4)); | 4788 | max (0, min (scroll_margin, w->total_lines / 4)); |
| 4810 | 4789 | ||
| 4811 | set_marker_restricted_both (w->start, w->buffer, pos, pos_byte); | 4790 | set_marker_restricted_both (w->start, w->contents, pos, pos_byte); |
| 4812 | w->start_at_line_beg = !NILP (bolp); | 4791 | w->start_at_line_beg = !NILP (bolp); |
| 4813 | w->update_mode_line = 1; | 4792 | w->update_mode_line = 1; |
| 4814 | w->last_modified = 0; | 4793 | w->last_modified = 0; |
| @@ -4902,10 +4881,10 @@ scroll_command (Lisp_Object n, int direction) | |||
| 4902 | 4881 | ||
| 4903 | /* If selected window's buffer isn't current, make it current for | 4882 | /* If selected window's buffer isn't current, make it current for |
| 4904 | the moment. But don't screw up if window_scroll gets an error. */ | 4883 | the moment. But don't screw up if window_scroll gets an error. */ |
| 4905 | if (XBUFFER (XWINDOW (selected_window)->buffer) != current_buffer) | 4884 | if (XBUFFER (XWINDOW (selected_window)->contents) != current_buffer) |
| 4906 | { | 4885 | { |
| 4907 | record_unwind_protect (save_excursion_restore, save_excursion_save ()); | 4886 | record_unwind_protect (save_excursion_restore, save_excursion_save ()); |
| 4908 | Fset_buffer (XWINDOW (selected_window)->buffer); | 4887 | Fset_buffer (XWINDOW (selected_window)->contents); |
| 4909 | 4888 | ||
| 4910 | /* Make redisplay consider other windows than just selected_window. */ | 4889 | /* Make redisplay consider other windows than just selected_window. */ |
| 4911 | ++windows_or_buffers_changed; | 4890 | ++windows_or_buffers_changed; |
| @@ -5020,7 +4999,7 @@ specifies the window to scroll. This takes precedence over | |||
| 5020 | record_unwind_protect (save_excursion_restore, save_excursion_save ()); | 4999 | record_unwind_protect (save_excursion_restore, save_excursion_save ()); |
| 5021 | ++windows_or_buffers_changed; | 5000 | ++windows_or_buffers_changed; |
| 5022 | 5001 | ||
| 5023 | Fset_buffer (w->buffer); | 5002 | Fset_buffer (w->contents); |
| 5024 | SET_PT_BOTH (marker_position (w->pointm), marker_byte_position (w->pointm)); | 5003 | SET_PT_BOTH (marker_position (w->pointm), marker_byte_position (w->pointm)); |
| 5025 | 5004 | ||
| 5026 | if (NILP (arg)) | 5005 | if (NILP (arg)) |
| @@ -5114,10 +5093,10 @@ displayed_window_lines (struct window *w) | |||
| 5114 | int bottom_y; | 5093 | int bottom_y; |
| 5115 | void *itdata = NULL; | 5094 | void *itdata = NULL; |
| 5116 | 5095 | ||
| 5117 | if (XBUFFER (w->buffer) != current_buffer) | 5096 | if (XBUFFER (w->contents) != current_buffer) |
| 5118 | { | 5097 | { |
| 5119 | old_buffer = current_buffer; | 5098 | old_buffer = current_buffer; |
| 5120 | set_buffer_internal (XBUFFER (w->buffer)); | 5099 | set_buffer_internal (XBUFFER (w->contents)); |
| 5121 | } | 5100 | } |
| 5122 | else | 5101 | else |
| 5123 | old_buffer = NULL; | 5102 | old_buffer = NULL; |
| @@ -5179,7 +5158,7 @@ and redisplay normally--don't erase and redraw the frame. */) | |||
| 5179 | (register Lisp_Object arg) | 5158 | (register Lisp_Object arg) |
| 5180 | { | 5159 | { |
| 5181 | struct window *w = XWINDOW (selected_window); | 5160 | struct window *w = XWINDOW (selected_window); |
| 5182 | struct buffer *buf = XBUFFER (w->buffer); | 5161 | struct buffer *buf = XBUFFER (w->contents); |
| 5183 | struct buffer *obuf = current_buffer; | 5162 | struct buffer *obuf = current_buffer; |
| 5184 | int center_p = 0; | 5163 | int center_p = 0; |
| 5185 | ptrdiff_t charpos, bytepos; | 5164 | ptrdiff_t charpos, bytepos; |
| @@ -5223,7 +5202,7 @@ and redisplay normally--don't erase and redraw the frame. */) | |||
| 5223 | /* Do this after making BUF current | 5202 | /* Do this after making BUF current |
| 5224 | in case scroll_margin is buffer-local. */ | 5203 | in case scroll_margin is buffer-local. */ |
| 5225 | this_scroll_margin = | 5204 | this_scroll_margin = |
| 5226 | max (0, min (scroll_margin, XFASTINT (w->total_lines) / 4)); | 5205 | max (0, min (scroll_margin, w->total_lines / 4)); |
| 5227 | 5206 | ||
| 5228 | /* Handle centering on a graphical frame specially. Such frames can | 5207 | /* Handle centering on a graphical frame specially. Such frames can |
| 5229 | have variable-height lines and centering point on the basis of | 5208 | have variable-height lines and centering point on the basis of |
| @@ -5345,7 +5324,7 @@ and redisplay normally--don't erase and redraw the frame. */) | |||
| 5345 | } | 5324 | } |
| 5346 | 5325 | ||
| 5347 | /* Set the new window start. */ | 5326 | /* Set the new window start. */ |
| 5348 | set_marker_both (w->start, w->buffer, charpos, bytepos); | 5327 | set_marker_both (w->start, w->contents, charpos, bytepos); |
| 5349 | w->window_end_valid = 0; | 5328 | w->window_end_valid = 0; |
| 5350 | 5329 | ||
| 5351 | w->optional_new_start = 1; | 5330 | w->optional_new_start = 1; |
| @@ -5389,9 +5368,8 @@ zero means top of window, negative means relative to bottom of window. */) | |||
| 5389 | int this_scroll_margin; | 5368 | int this_scroll_margin; |
| 5390 | #endif | 5369 | #endif |
| 5391 | 5370 | ||
| 5392 | if (!(BUFFERP (w->buffer) | 5371 | if (!(BUFFERP (w->contents) && XBUFFER (w->contents) == current_buffer)) |
| 5393 | && XBUFFER (w->buffer) == current_buffer)) | 5372 | /* This test is needed to make sure PT/PT_BYTE make sense in w->contents |
| 5394 | /* This test is needed to make sure PT/PT_BYTE make sense in w->buffer | ||
| 5395 | when passed below to set_marker_both. */ | 5373 | when passed below to set_marker_both. */ |
| 5396 | error ("move-to-window-line called from unrelated buffer"); | 5374 | error ("move-to-window-line called from unrelated buffer"); |
| 5397 | 5375 | ||
| @@ -5401,7 +5379,7 @@ zero means top of window, negative means relative to bottom of window. */) | |||
| 5401 | { | 5379 | { |
| 5402 | int height = window_internal_height (w); | 5380 | int height = window_internal_height (w); |
| 5403 | Fvertical_motion (make_number (- (height / 2)), window); | 5381 | Fvertical_motion (make_number (- (height / 2)), window); |
| 5404 | set_marker_both (w->start, w->buffer, PT, PT_BYTE); | 5382 | set_marker_both (w->start, w->contents, PT, PT_BYTE); |
| 5405 | w->start_at_line_beg = !NILP (Fbolp ()); | 5383 | w->start_at_line_beg = !NILP (Fbolp ()); |
| 5406 | w->force_start = 1; | 5384 | w->force_start = 1; |
| 5407 | } | 5385 | } |
| @@ -5551,9 +5529,9 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5551 | window-point of the final-selected-window to the window-point of | 5529 | window-point of the final-selected-window to the window-point of |
| 5552 | the current-selected-window. So we have to be careful which | 5530 | the current-selected-window. So we have to be careful which |
| 5553 | point of the current-buffer we copy into old_point. */ | 5531 | point of the current-buffer we copy into old_point. */ |
| 5554 | if (EQ (XWINDOW (data->current_window)->buffer, new_current_buffer) | 5532 | if (EQ (XWINDOW (data->current_window)->contents, new_current_buffer) |
| 5555 | && WINDOWP (selected_window) | 5533 | && WINDOWP (selected_window) |
| 5556 | && EQ (XWINDOW (selected_window)->buffer, new_current_buffer) | 5534 | && EQ (XWINDOW (selected_window)->contents, new_current_buffer) |
| 5557 | && !EQ (selected_window, data->current_window)) | 5535 | && !EQ (selected_window, data->current_window)) |
| 5558 | old_point = marker_position (XWINDOW (data->current_window)->pointm); | 5536 | old_point = marker_position (XWINDOW (data->current_window)->pointm); |
| 5559 | else | 5537 | else |
| @@ -5567,7 +5545,7 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5567 | So if possible we want this arbitrary choice of "which point" to | 5545 | So if possible we want this arbitrary choice of "which point" to |
| 5568 | be the one from the to-be-selected-window so as to prevent this | 5546 | be the one from the to-be-selected-window so as to prevent this |
| 5569 | window's cursor from being copied from another window. */ | 5547 | window's cursor from being copied from another window. */ |
| 5570 | if (EQ (XWINDOW (data->current_window)->buffer, new_current_buffer) | 5548 | if (EQ (XWINDOW (data->current_window)->contents, new_current_buffer) |
| 5571 | /* If current_window = selected_window, its point is in BUF_PT. */ | 5549 | /* If current_window = selected_window, its point is in BUF_PT. */ |
| 5572 | && !EQ (selected_window, data->current_window)) | 5550 | && !EQ (selected_window, data->current_window)) |
| 5573 | old_point = marker_position (XWINDOW (data->current_window)->pointm); | 5551 | old_point = marker_position (XWINDOW (data->current_window)->pointm); |
| @@ -5609,8 +5587,8 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5609 | p = SAVED_WINDOW_N (saved_windows, k); | 5587 | p = SAVED_WINDOW_N (saved_windows, k); |
| 5610 | window = p->window; | 5588 | window = p->window; |
| 5611 | w = XWINDOW (window); | 5589 | w = XWINDOW (window); |
| 5612 | if (!NILP (w->buffer) | 5590 | if (BUFFERP (w->contents) |
| 5613 | && !EQ (w->buffer, p->buffer) | 5591 | && !EQ (w->contents, p->buffer) |
| 5614 | && BUFFER_LIVE_P (XBUFFER (p->buffer))) | 5592 | && BUFFER_LIVE_P (XBUFFER (p->buffer))) |
| 5615 | /* If a window we restore gets another buffer, record the | 5593 | /* If a window we restore gets another buffer, record the |
| 5616 | window's old buffer. */ | 5594 | window's old buffer. */ |
| @@ -5643,13 +5621,13 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5643 | window holds garbage.) We do this now, before | 5621 | window holds garbage.) We do this now, before |
| 5644 | restoring the window contents, and prevent it from | 5622 | restoring the window contents, and prevent it from |
| 5645 | being done later on when we select a new window. */ | 5623 | being done later on when we select a new window. */ |
| 5646 | if (! NILP (XWINDOW (selected_window)->buffer)) | 5624 | if (! NILP (XWINDOW (selected_window)->contents)) |
| 5647 | { | 5625 | { |
| 5648 | w = XWINDOW (selected_window); | 5626 | w = XWINDOW (selected_window); |
| 5649 | set_marker_both (w->pointm, | 5627 | set_marker_both (w->pointm, |
| 5650 | w->buffer, | 5628 | w->contents, |
| 5651 | BUF_PT (XBUFFER (w->buffer)), | 5629 | BUF_PT (XBUFFER (w->contents)), |
| 5652 | BUF_PT_BYTE (XBUFFER (w->buffer))); | 5630 | BUF_PT_BYTE (XBUFFER (w->contents))); |
| 5653 | } | 5631 | } |
| 5654 | 5632 | ||
| 5655 | windows_or_buffers_changed++; | 5633 | windows_or_buffers_changed++; |
| @@ -5696,28 +5674,19 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5696 | { | 5674 | { |
| 5697 | wset_prev (w, Qnil); | 5675 | wset_prev (w, Qnil); |
| 5698 | if (!NILP (w->parent)) | 5676 | if (!NILP (w->parent)) |
| 5699 | { | 5677 | wset_combination (XWINDOW (w->parent), |
| 5700 | if (EQ (p->total_cols, XWINDOW (w->parent)->total_cols)) | 5678 | (XINT (p->total_cols) |
| 5701 | { | 5679 | != XWINDOW (w->parent)->total_cols), |
| 5702 | wset_vchild (XWINDOW (w->parent), p->window); | 5680 | p->window); |
| 5703 | wset_hchild (XWINDOW (w->parent), Qnil); | ||
| 5704 | } | ||
| 5705 | else | ||
| 5706 | { | ||
| 5707 | wset_hchild (XWINDOW (w->parent), p->window); | ||
| 5708 | wset_vchild (XWINDOW (w->parent), Qnil); | ||
| 5709 | } | ||
| 5710 | } | ||
| 5711 | } | 5681 | } |
| 5712 | 5682 | ||
| 5713 | /* If we squirreled away the buffer in the window's height, | 5683 | /* If we squirreled away the buffer, restore it now. */ |
| 5714 | restore it now. */ | 5684 | if (BUFFERP (w->combination_limit)) |
| 5715 | if (BUFFERP (w->total_lines)) | 5685 | wset_buffer (w, w->combination_limit); |
| 5716 | wset_buffer (w, w->total_lines); | 5686 | w->left_col = XFASTINT (p->left_col); |
| 5717 | wset_left_col (w, p->left_col); | 5687 | w->top_line = XFASTINT (p->top_line); |
| 5718 | wset_top_line (w, p->top_line); | 5688 | w->total_cols = XFASTINT (p->total_cols); |
| 5719 | wset_total_cols (w, p->total_cols); | 5689 | w->total_lines = XFASTINT (p->total_lines); |
| 5720 | wset_total_lines (w, p->total_lines); | ||
| 5721 | wset_normal_cols (w, p->normal_cols); | 5690 | wset_normal_cols (w, p->normal_cols); |
| 5722 | wset_normal_lines (w, p->normal_lines); | 5691 | wset_normal_lines (w, p->normal_lines); |
| 5723 | w->hscroll = XFASTINT (p->hscroll); | 5692 | w->hscroll = XFASTINT (p->hscroll); |
| @@ -5757,20 +5726,16 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5757 | w->last_modified = 0; | 5726 | w->last_modified = 0; |
| 5758 | w->last_overlay_modified = 0; | 5727 | w->last_overlay_modified = 0; |
| 5759 | 5728 | ||
| 5760 | /* Reinstall the saved buffer and pointers into it. */ | 5729 | if (BUFFERP (p->buffer) && BUFFER_LIVE_P (XBUFFER (p->buffer))) |
| 5761 | if (NILP (p->buffer)) | ||
| 5762 | /* An internal window. */ | ||
| 5763 | wset_buffer (w, p->buffer); | ||
| 5764 | else if (BUFFER_LIVE_P (XBUFFER (p->buffer))) | ||
| 5765 | /* If saved buffer is alive, install it. */ | 5730 | /* If saved buffer is alive, install it. */ |
| 5766 | { | 5731 | { |
| 5767 | wset_buffer (w, p->buffer); | 5732 | wset_buffer (w, p->buffer); |
| 5768 | w->start_at_line_beg = !NILP (p->start_at_line_beg); | 5733 | w->start_at_line_beg = !NILP (p->start_at_line_beg); |
| 5769 | set_marker_restricted (w->start, p->start, w->buffer); | 5734 | set_marker_restricted (w->start, p->start, w->contents); |
| 5770 | set_marker_restricted (w->pointm, p->pointm, | 5735 | set_marker_restricted (w->pointm, p->pointm, |
| 5771 | w->buffer); | 5736 | w->contents); |
| 5772 | Fset_marker (BVAR (XBUFFER (w->buffer), mark), | 5737 | Fset_marker (BVAR (XBUFFER (w->contents), mark), |
| 5773 | p->mark, w->buffer); | 5738 | p->mark, w->contents); |
| 5774 | 5739 | ||
| 5775 | /* As documented in Fcurrent_window_configuration, don't | 5740 | /* As documented in Fcurrent_window_configuration, don't |
| 5776 | restore the location of point in the buffer which was | 5741 | restore the location of point in the buffer which was |
| @@ -5779,23 +5744,21 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5779 | && XBUFFER (p->buffer) == current_buffer) | 5744 | && XBUFFER (p->buffer) == current_buffer) |
| 5780 | Fgoto_char (w->pointm); | 5745 | Fgoto_char (w->pointm); |
| 5781 | } | 5746 | } |
| 5782 | else if (!NILP (w->buffer) | 5747 | else if (BUFFERP (w->contents) && BUFFER_LIVE_P (XBUFFER (w->contents))) |
| 5783 | && BUFFER_LIVE_P (XBUFFER (w->buffer))) | 5748 | /* Keep window's old buffer; make sure the markers are real. */ |
| 5784 | /* Keep window's old buffer; make sure the markers are | 5749 | { |
| 5785 | real. */ | 5750 | /* Set window markers at start of visible range. */ |
| 5786 | { | 5751 | if (XMARKER (w->start)->buffer == 0) |
| 5787 | /* Set window markers at start of visible range. */ | 5752 | set_marker_restricted_both (w->start, w->contents, 0, 0); |
| 5788 | if (XMARKER (w->start)->buffer == 0) | 5753 | if (XMARKER (w->pointm)->buffer == 0) |
| 5789 | set_marker_restricted_both (w->start, w->buffer, 0, 0); | 5754 | set_marker_restricted_both |
| 5790 | if (XMARKER (w->pointm)->buffer == 0) | 5755 | (w->pointm, w->contents, |
| 5791 | set_marker_restricted_both | 5756 | BUF_PT (XBUFFER (w->contents)), |
| 5792 | (w->pointm, w->buffer, | 5757 | BUF_PT_BYTE (XBUFFER (w->contents))); |
| 5793 | BUF_PT (XBUFFER (w->buffer)), | 5758 | w->start_at_line_beg = 1; |
| 5794 | BUF_PT_BYTE (XBUFFER (w->buffer))); | 5759 | } |
| 5795 | w->start_at_line_beg = 1; | 5760 | else if (!NILP (w->start)) |
| 5796 | } | 5761 | /* Leaf window has no live buffer, get one. */ |
| 5797 | else | ||
| 5798 | /* Window has no live buffer, get one. */ | ||
| 5799 | { | 5762 | { |
| 5800 | /* Get the buffer via other_buffer_safely in order to | 5763 | /* Get the buffer via other_buffer_safely in order to |
| 5801 | avoid showing an unimportant buffer and, if necessary, to | 5764 | avoid showing an unimportant buffer and, if necessary, to |
| @@ -5804,8 +5767,8 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5804 | wset_buffer (w, other_buffer_safely (Fcurrent_buffer ())); | 5767 | wset_buffer (w, other_buffer_safely (Fcurrent_buffer ())); |
| 5805 | /* This will set the markers to beginning of visible | 5768 | /* This will set the markers to beginning of visible |
| 5806 | range. */ | 5769 | range. */ |
| 5807 | set_marker_restricted_both (w->start, w->buffer, 0, 0); | 5770 | set_marker_restricted_both (w->start, w->contents, 0, 0); |
| 5808 | set_marker_restricted_both (w->pointm, w->buffer, 0, 0); | 5771 | set_marker_restricted_both (w->pointm, w->contents, 0, 0); |
| 5809 | w->start_at_line_beg = 1; | 5772 | w->start_at_line_beg = 1; |
| 5810 | if (!NILP (w->dedicated)) | 5773 | if (!NILP (w->dedicated)) |
| 5811 | /* Record this window as dead. */ | 5774 | /* Record this window as dead. */ |
| @@ -5818,17 +5781,17 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5818 | fset_root_window (f, data->root_window); | 5781 | fset_root_window (f, data->root_window); |
| 5819 | /* Arrange *not* to restore point in the buffer that was | 5782 | /* Arrange *not* to restore point in the buffer that was |
| 5820 | current when the window configuration was saved. */ | 5783 | current when the window configuration was saved. */ |
| 5821 | if (EQ (XWINDOW (data->current_window)->buffer, new_current_buffer)) | 5784 | if (EQ (XWINDOW (data->current_window)->contents, new_current_buffer)) |
| 5822 | set_marker_restricted (XWINDOW (data->current_window)->pointm, | 5785 | set_marker_restricted (XWINDOW (data->current_window)->pointm, |
| 5823 | make_number (old_point), | 5786 | make_number (old_point), |
| 5824 | XWINDOW (data->current_window)->buffer); | 5787 | XWINDOW (data->current_window)->contents); |
| 5825 | 5788 | ||
| 5826 | /* In the following call to `select-window', prevent "swapping out | 5789 | /* In the following call to `select-window', prevent "swapping out |
| 5827 | point" in the old selected window using the buffer that has | 5790 | point" in the old selected window using the buffer that has |
| 5828 | been restored into it. We already swapped out that point from | 5791 | been restored into it. We already swapped out that point from |
| 5829 | that window's old buffer. */ | 5792 | that window's old buffer. */ |
| 5830 | select_window (data->current_window, Qnil, 1); | 5793 | select_window (data->current_window, Qnil, 1); |
| 5831 | BVAR (XBUFFER (XWINDOW (selected_window)->buffer), last_selected_window) | 5794 | BVAR (XBUFFER (XWINDOW (selected_window)->contents), last_selected_window) |
| 5832 | = selected_window; | 5795 | = selected_window; |
| 5833 | 5796 | ||
| 5834 | if (NILP (data->focus_frame) | 5797 | if (NILP (data->focus_frame) |
| @@ -5855,14 +5818,9 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5855 | /* Now, free glyph matrices in windows that were not reused. */ | 5818 | /* Now, free glyph matrices in windows that were not reused. */ |
| 5856 | for (i = n = 0; i < n_leaf_windows; ++i) | 5819 | for (i = n = 0; i < n_leaf_windows; ++i) |
| 5857 | { | 5820 | { |
| 5858 | if (NILP (leaf_windows[i]->buffer)) | 5821 | if (NILP (leaf_windows[i]->contents)) |
| 5859 | { | 5822 | free_window_matrices (leaf_windows[i]); |
| 5860 | /* Assert it's not reused as a combination. */ | 5823 | else if (EQ (leaf_windows[i]->contents, new_current_buffer)) |
| 5861 | eassert (NILP (leaf_windows[i]->hchild) | ||
| 5862 | && NILP (leaf_windows[i]->vchild)); | ||
| 5863 | free_window_matrices (leaf_windows[i]); | ||
| 5864 | } | ||
| 5865 | else if (EQ (leaf_windows[i]->buffer, new_current_buffer)) | ||
| 5866 | ++n; | 5824 | ++n; |
| 5867 | } | 5825 | } |
| 5868 | 5826 | ||
| @@ -5893,7 +5851,7 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5893 | Fset_buffer (new_current_buffer); | 5851 | Fset_buffer (new_current_buffer); |
| 5894 | /* If the new current buffer doesn't appear in the selected | 5852 | /* If the new current buffer doesn't appear in the selected |
| 5895 | window, go to its old point (see bug#12208). */ | 5853 | window, go to its old point (see bug#12208). */ |
| 5896 | if (!EQ (XWINDOW (data->current_window)->buffer, new_current_buffer)) | 5854 | if (!EQ (XWINDOW (data->current_window)->contents, new_current_buffer)) |
| 5897 | Fgoto_char (make_number (old_point)); | 5855 | Fgoto_char (make_number (old_point)); |
| 5898 | } | 5856 | } |
| 5899 | 5857 | ||
| @@ -5904,8 +5862,10 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5904 | } | 5862 | } |
| 5905 | 5863 | ||
| 5906 | 5864 | ||
| 5907 | /* Recursively delete all child windows reachable via the next, vchild, | 5865 | /* If WINDOW is an internal window, recursively delete all child windows |
| 5908 | and hchild slots of WINDOW. */ | 5866 | reachable via the next and contents slots of WINDOW. Otherwise setup |
| 5867 | WINDOW to not show any buffer. */ | ||
| 5868 | |||
| 5909 | void | 5869 | void |
| 5910 | delete_all_child_windows (Lisp_Object window) | 5870 | delete_all_child_windows (Lisp_Object window) |
| 5911 | { | 5871 | { |
| @@ -5917,24 +5877,20 @@ delete_all_child_windows (Lisp_Object window) | |||
| 5917 | /* Delete WINDOW's siblings (we traverse postorderly). */ | 5877 | /* Delete WINDOW's siblings (we traverse postorderly). */ |
| 5918 | delete_all_child_windows (w->next); | 5878 | delete_all_child_windows (w->next); |
| 5919 | 5879 | ||
| 5920 | /* See Fset_window_configuration for excuse. */ | 5880 | if (WINDOWP (w->contents)) |
| 5921 | wset_total_lines (w, w->buffer); | ||
| 5922 | |||
| 5923 | if (!NILP (w->vchild)) | ||
| 5924 | { | ||
| 5925 | delete_all_child_windows (w->vchild); | ||
| 5926 | wset_vchild (w, Qnil); | ||
| 5927 | } | ||
| 5928 | else if (!NILP (w->hchild)) | ||
| 5929 | { | 5881 | { |
| 5930 | delete_all_child_windows (w->hchild); | 5882 | delete_all_child_windows (w->contents); |
| 5931 | wset_hchild (w, Qnil); | 5883 | wset_combination (w, 0, Qnil); |
| 5932 | } | 5884 | } |
| 5933 | else if (!NILP (w->buffer)) | 5885 | else if (BUFFERP (w->contents)) |
| 5934 | { | 5886 | { |
| 5935 | unshow_buffer (w); | 5887 | unshow_buffer (w); |
| 5936 | unchain_marker (XMARKER (w->pointm)); | 5888 | unchain_marker (XMARKER (w->pointm)); |
| 5937 | unchain_marker (XMARKER (w->start)); | 5889 | unchain_marker (XMARKER (w->start)); |
| 5890 | /* Since combination limit makes sense for an internal windows | ||
| 5891 | only, we use this slot to save the buffer for the sake of | ||
| 5892 | possible resurrection in Fset_window_configuration. */ | ||
| 5893 | wset_combination_limit (w, w->contents); | ||
| 5938 | wset_buffer (w, Qnil); | 5894 | wset_buffer (w, Qnil); |
| 5939 | } | 5895 | } |
| 5940 | 5896 | ||
| @@ -5947,10 +5903,8 @@ count_windows (register struct window *window) | |||
| 5947 | register int count = 1; | 5903 | register int count = 1; |
| 5948 | if (!NILP (window->next)) | 5904 | if (!NILP (window->next)) |
| 5949 | count += count_windows (XWINDOW (window->next)); | 5905 | count += count_windows (XWINDOW (window->next)); |
| 5950 | if (!NILP (window->vchild)) | 5906 | if (WINDOWP (window->contents)) |
| 5951 | count += count_windows (XWINDOW (window->vchild)); | 5907 | count += count_windows (XWINDOW (window->contents)); |
| 5952 | if (!NILP (window->hchild)) | ||
| 5953 | count += count_windows (XWINDOW (window->hchild)); | ||
| 5954 | return count; | 5908 | return count; |
| 5955 | } | 5909 | } |
| 5956 | 5910 | ||
| @@ -5962,10 +5916,8 @@ get_leaf_windows (struct window *w, struct window **flat, int i) | |||
| 5962 | { | 5916 | { |
| 5963 | while (w) | 5917 | while (w) |
| 5964 | { | 5918 | { |
| 5965 | if (!NILP (w->hchild)) | 5919 | if (WINDOWP (w->contents)) |
| 5966 | i = get_leaf_windows (XWINDOW (w->hchild), flat, i); | 5920 | i = get_leaf_windows (XWINDOW (w->contents), flat, i); |
| 5967 | else if (!NILP (w->vchild)) | ||
| 5968 | i = get_leaf_windows (XWINDOW (w->vchild), flat, i); | ||
| 5969 | else | 5921 | else |
| 5970 | flat[i++] = w; | 5922 | flat[i++] = w; |
| 5971 | 5923 | ||
| @@ -6005,8 +5957,7 @@ get_phys_cursor_glyph (struct window *w) | |||
| 6005 | hpos = row->used[TEXT_AREA] - 1; | 5957 | hpos = row->used[TEXT_AREA] - 1; |
| 6006 | } | 5958 | } |
| 6007 | 5959 | ||
| 6008 | if (row->used[TEXT_AREA] > hpos | 5960 | if (0 <= hpos && hpos < row->used[TEXT_AREA]) |
| 6009 | && 0 <= hpos) | ||
| 6010 | glyph = row->glyphs[TEXT_AREA] + hpos; | 5961 | glyph = row->glyphs[TEXT_AREA] + hpos; |
| 6011 | else | 5962 | else |
| 6012 | glyph = NULL; | 5963 | glyph = NULL; |
| @@ -6022,18 +5973,18 @@ save_window_save (Lisp_Object window, struct Lisp_Vector *vector, int i) | |||
| 6022 | register struct window *w; | 5973 | register struct window *w; |
| 6023 | register Lisp_Object tem, pers, par; | 5974 | register Lisp_Object tem, pers, par; |
| 6024 | 5975 | ||
| 6025 | for (;!NILP (window); window = w->next) | 5976 | for (; !NILP (window); window = w->next) |
| 6026 | { | 5977 | { |
| 6027 | p = SAVED_WINDOW_N (vector, i); | 5978 | p = SAVED_WINDOW_N (vector, i); |
| 6028 | w = XWINDOW (window); | 5979 | w = XWINDOW (window); |
| 6029 | 5980 | ||
| 6030 | wset_temslot (w, make_number (i)); i++; | 5981 | wset_temslot (w, make_number (i)); i++; |
| 6031 | p->window = window; | 5982 | p->window = window; |
| 6032 | p->buffer = w->buffer; | 5983 | p->buffer = (WINDOW_LEAF_P (w) ? w->contents : Qnil); |
| 6033 | p->left_col = w->left_col; | 5984 | p->left_col = make_number (w->left_col); |
| 6034 | p->top_line = w->top_line; | 5985 | p->top_line = make_number (w->top_line); |
| 6035 | p->total_cols = w->total_cols; | 5986 | p->total_cols = make_number (w->total_cols); |
| 6036 | p->total_lines = w->total_lines; | 5987 | p->total_lines = make_number (w->total_lines); |
| 6037 | p->normal_cols = w->normal_cols; | 5988 | p->normal_cols = w->normal_cols; |
| 6038 | p->normal_lines = w->normal_lines; | 5989 | p->normal_lines = w->normal_lines; |
| 6039 | XSETFASTINT (p->hscroll, w->hscroll); | 5990 | XSETFASTINT (p->hscroll, w->hscroll); |
| @@ -6096,15 +6047,15 @@ save_window_save (Lisp_Object window, struct Lisp_Vector *vector, int i) | |||
| 6096 | } | 6047 | } |
| 6097 | } | 6048 | } |
| 6098 | 6049 | ||
| 6099 | if (!NILP (w->buffer)) | 6050 | if (BUFFERP (w->contents)) |
| 6100 | { | 6051 | { |
| 6101 | /* Save w's value of point in the window configuration. If w | 6052 | /* Save w's value of point in the window configuration. If w |
| 6102 | is the selected window, then get the value of point from | 6053 | is the selected window, then get the value of point from |
| 6103 | the buffer; pointm is garbage in the selected window. */ | 6054 | the buffer; pointm is garbage in the selected window. */ |
| 6104 | if (EQ (window, selected_window)) | 6055 | if (EQ (window, selected_window)) |
| 6105 | p->pointm = build_marker (XBUFFER (w->buffer), | 6056 | p->pointm = build_marker (XBUFFER (w->contents), |
| 6106 | BUF_PT (XBUFFER (w->buffer)), | 6057 | BUF_PT (XBUFFER (w->contents)), |
| 6107 | BUF_PT_BYTE (XBUFFER (w->buffer))); | 6058 | BUF_PT_BYTE (XBUFFER (w->contents))); |
| 6108 | else | 6059 | else |
| 6109 | p->pointm = Fcopy_marker (w->pointm, Qnil); | 6060 | p->pointm = Fcopy_marker (w->pointm, Qnil); |
| 6110 | XMARKER (p->pointm)->insertion_type | 6061 | XMARKER (p->pointm)->insertion_type |
| @@ -6113,7 +6064,7 @@ save_window_save (Lisp_Object window, struct Lisp_Vector *vector, int i) | |||
| 6113 | p->start = Fcopy_marker (w->start, Qnil); | 6064 | p->start = Fcopy_marker (w->start, Qnil); |
| 6114 | p->start_at_line_beg = w->start_at_line_beg ? Qt : Qnil; | 6065 | p->start_at_line_beg = w->start_at_line_beg ? Qt : Qnil; |
| 6115 | 6066 | ||
| 6116 | tem = BVAR (XBUFFER (w->buffer), mark); | 6067 | tem = BVAR (XBUFFER (w->contents), mark); |
| 6117 | p->mark = Fcopy_marker (tem, Qnil); | 6068 | p->mark = Fcopy_marker (tem, Qnil); |
| 6118 | } | 6069 | } |
| 6119 | else | 6070 | else |
| @@ -6134,10 +6085,8 @@ save_window_save (Lisp_Object window, struct Lisp_Vector *vector, int i) | |||
| 6134 | else | 6085 | else |
| 6135 | p->prev = XWINDOW (w->prev)->temslot; | 6086 | p->prev = XWINDOW (w->prev)->temslot; |
| 6136 | 6087 | ||
| 6137 | if (!NILP (w->vchild)) | 6088 | if (WINDOWP (w->contents)) |
| 6138 | i = save_window_save (w->vchild, vector, i); | 6089 | i = save_window_save (w->contents, vector, i); |
| 6139 | if (!NILP (w->hchild)) | ||
| 6140 | i = save_window_save (w->hchild, vector, i); | ||
| 6141 | } | 6090 | } |
| 6142 | 6091 | ||
| 6143 | return i; | 6092 | return i; |
| @@ -6454,7 +6403,7 @@ If PIXELS-P is non-nil, the return value is VSCROLL. */) | |||
| 6454 | adjust_glyphs (f); | 6403 | adjust_glyphs (f); |
| 6455 | 6404 | ||
| 6456 | /* Prevent redisplay shortcuts. */ | 6405 | /* Prevent redisplay shortcuts. */ |
| 6457 | XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1; | 6406 | XBUFFER (w->contents)->prevent_redisplay_optimizations_p = 1; |
| 6458 | } | 6407 | } |
| 6459 | } | 6408 | } |
| 6460 | 6409 | ||
| @@ -6488,10 +6437,8 @@ foreach_window_1 (struct window *w, int (*fn) (struct window *, void *), void *u | |||
| 6488 | 6437 | ||
| 6489 | for (cont = 1; w && cont;) | 6438 | for (cont = 1; w && cont;) |
| 6490 | { | 6439 | { |
| 6491 | if (!NILP (w->hchild)) | 6440 | if (WINDOWP (w->contents)) |
| 6492 | cont = foreach_window_1 (XWINDOW (w->hchild), fn, user_data); | 6441 | cont = foreach_window_1 (XWINDOW (w->contents), fn, user_data); |
| 6493 | else if (!NILP (w->vchild)) | ||
| 6494 | cont = foreach_window_1 (XWINDOW (w->vchild), fn, user_data); | ||
| 6495 | else | 6442 | else |
| 6496 | cont = fn (w, user_data); | 6443 | cont = fn (w, user_data); |
| 6497 | 6444 | ||
| @@ -6527,7 +6474,7 @@ freeze_window_start (struct window *w, void *freeze_p) | |||
| 6527 | means freeze the window start. */ | 6474 | means freeze the window start. */ |
| 6528 | 6475 | ||
| 6529 | void | 6476 | void |
| 6530 | freeze_window_starts (struct frame *f, int freeze_p) | 6477 | freeze_window_starts (struct frame *f, bool freeze_p) |
| 6531 | { | 6478 | { |
| 6532 | foreach_window (f, freeze_window_start, (void *) (freeze_p ? f : 0)); | 6479 | foreach_window (f, freeze_window_start, (void *) (freeze_p ? f : 0)); |
| 6533 | } | 6480 | } |