diff options
| author | Martin Rudalics | 2011-06-08 10:35:20 +0200 |
|---|---|---|
| committer | Martin Rudalics | 2011-06-08 10:35:20 +0200 |
| commit | 496e208ef95f8c691f4fe36d6ad6adbe3dedcd15 (patch) | |
| tree | ec79ee5d45bf8d20ab71c75c366c69e5f2e43fe6 /src/window.c | |
| parent | 2c5871045a2b87432ad62ebf13672abe81fae0ba (diff) | |
| download | emacs-496e208ef95f8c691f4fe36d6ad6adbe3dedcd15.tar.gz emacs-496e208ef95f8c691f4fe36d6ad6adbe3dedcd15.zip | |
Add some new members to window structure in window.h.
* window.h (window): Add some new members to window structure -
normal_lines, normal_cols, new_total, new_normal, clone_number,
splits, nest, prev_buffers, next_buffers.
(WINDOW_TOTAL_SIZE): Move here from window.c.
(MIN_SAFE_WINDOW_WIDTH, MIN_SAFE_WINDOW_HEIGHT): Define.
* window.c (WINDOW_TOTAL_SIZE): Move to window.h.
(make_dummy_parent): Set new members of windows structure.
(make_window): Move down in code. Handle new members of window
structure.
(Fwindow_clone_number, Fwindow_splits, Fset_window_splits)
(Fwindow_nest, Fset_window_nest, Fwindow_new_total)
(Fwindow_normal_size, Fwindow_new_normal, Fwindow_prev_buffers)
(Fset_window_prev_buffers, Fwindow_next_buffers)
(Fset_window_next_buffers, Fset_window_clone_number): New
functions.
(Fwindow_hscroll, Fwindow_at, Fwindow_point, Fwindow_start)
(Fwindow_end, Fwindow_line_height, Fset_window_dedicated_p):
Doc-string fixes.
(Fwindow_parameters, Fwindow_parameter, Fset_window_parameter):
Argument WINDOW can be now internal window too.
(Fwindow_use_time): Move up in code.
(Fget_buffer_window): Rename argument FRAME to ALL-FRAMES.
Rewrite doc-string.
(Fset_window_configuration, saved_window)
(Fcurrent_window_configuration, save_window_save): Handle new
members of window structure.
Diffstat (limited to 'src/window.c')
| -rw-r--r-- | src/window.c | 740 |
1 files changed, 494 insertions, 246 deletions
diff --git a/src/window.c b/src/window.c index 786619df755..85e076b4188 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -410,6 +410,14 @@ buffer of the selected window before each command. */) | |||
| 410 | return select_window (window, norecord, 0); | 410 | return select_window (window, norecord, 0); |
| 411 | } | 411 | } |
| 412 | 412 | ||
| 413 | DEFUN ("window-clone-number", Fwindow_clone_number, Swindow_clone_number, 0, 1, 0, | ||
| 414 | doc: /* Return WINDOW's clone number. | ||
| 415 | WINDOW can be any window and defaults to the selected one. */) | ||
| 416 | (Lisp_Object window) | ||
| 417 | { | ||
| 418 | return decode_any_window (window)->clone_number; | ||
| 419 | } | ||
| 420 | |||
| 413 | DEFUN ("window-buffer", Fwindow_buffer, Swindow_buffer, 0, 1, 0, | 421 | DEFUN ("window-buffer", Fwindow_buffer, Swindow_buffer, 0, 1, 0, |
| 414 | doc: /* Return the buffer that WINDOW is displaying. | 422 | doc: /* Return the buffer that WINDOW is displaying. |
| 415 | WINDOW can be any window and defaults to the selected one. | 423 | WINDOW can be any window and defaults to the selected one. |
| @@ -463,233 +471,80 @@ Return nil if WINDOW has no left sibling. */) | |||
| 463 | { | 471 | { |
| 464 | return decode_any_window (window)->prev; | 472 | return decode_any_window (window)->prev; |
| 465 | } | 473 | } |
| 466 | |||
| 467 | Lisp_Object | ||
| 468 | make_window (void) | ||
| 469 | { | ||
| 470 | Lisp_Object val; | ||
| 471 | register struct window *p; | ||
| 472 | |||
| 473 | p = allocate_window (); | ||
| 474 | ++sequence_number; | ||
| 475 | XSETFASTINT (p->sequence_number, sequence_number); | ||
| 476 | XSETFASTINT (p->left_col, 0); | ||
| 477 | XSETFASTINT (p->top_line, 0); | ||
| 478 | XSETFASTINT (p->total_lines, 0); | ||
| 479 | XSETFASTINT (p->total_cols, 0); | ||
| 480 | XSETFASTINT (p->hscroll, 0); | ||
| 481 | XSETFASTINT (p->min_hscroll, 0); | ||
| 482 | p->orig_top_line = p->orig_total_lines = Qnil; | ||
| 483 | p->start = Fmake_marker (); | ||
| 484 | p->pointm = Fmake_marker (); | ||
| 485 | XSETFASTINT (p->use_time, 0); | ||
| 486 | p->frame = Qnil; | ||
| 487 | p->display_table = Qnil; | ||
| 488 | p->dedicated = Qnil; | ||
| 489 | p->window_parameters = Qnil; | ||
| 490 | p->pseudo_window_p = 0; | ||
| 491 | memset (&p->cursor, 0, sizeof (p->cursor)); | ||
| 492 | memset (&p->last_cursor, 0, sizeof (p->last_cursor)); | ||
| 493 | memset (&p->phys_cursor, 0, sizeof (p->phys_cursor)); | ||
| 494 | p->desired_matrix = p->current_matrix = 0; | ||
| 495 | p->nrows_scale_factor = p->ncols_scale_factor = 1; | ||
| 496 | p->phys_cursor_type = -1; | ||
| 497 | p->phys_cursor_width = -1; | ||
| 498 | p->must_be_updated_p = 0; | ||
| 499 | XSETFASTINT (p->window_end_vpos, 0); | ||
| 500 | XSETFASTINT (p->window_end_pos, 0); | ||
| 501 | p->window_end_valid = Qnil; | ||
| 502 | p->vscroll = 0; | ||
| 503 | XSETWINDOW (val, p); | ||
| 504 | XSETFASTINT (p->last_point, 0); | ||
| 505 | p->frozen_window_start_p = 0; | ||
| 506 | p->last_cursor_off_p = p->cursor_off_p = 0; | ||
| 507 | p->left_margin_cols = Qnil; | ||
| 508 | p->right_margin_cols = Qnil; | ||
| 509 | p->left_fringe_width = Qnil; | ||
| 510 | p->right_fringe_width = Qnil; | ||
| 511 | p->fringes_outside_margins = Qnil; | ||
| 512 | p->scroll_bar_width = Qnil; | ||
| 513 | p->vertical_scroll_bar_type = Qt; | ||
| 514 | p->resize_proportionally = Qnil; | ||
| 515 | 474 | ||
| 516 | Vwindow_list = Qnil; | 475 | DEFUN ("window-splits", Fwindow_splits, Swindow_splits, 0, 1, 0, |
| 517 | return val; | 476 | doc: /* Return splits status for WINDOW. |
| 518 | } | 477 | WINDOW can be any window and defaults to the selected one. |
| 519 | 478 | ||
| 520 | DEFUN ("pos-visible-in-window-p", Fpos_visible_in_window_p, | 479 | If the value returned by this function is nil and WINDOW is resized, the |
| 521 | Spos_visible_in_window_p, 0, 3, 0, | 480 | corresponding space is preferably taken from (or given to) WINDOW's |
| 522 | doc: /* Return non-nil if position POS is currently on the frame in WINDOW. | 481 | right sibling. When WINDOW is deleted, its space is given to its left |
| 523 | Return nil if that position is scrolled vertically out of view. | 482 | sibling. |
| 524 | If a character is only partially visible, nil is returned, unless the | ||
| 525 | optional argument PARTIALLY is non-nil. | ||
| 526 | If POS is only out of view because of horizontal scrolling, return non-nil. | ||
| 527 | If POS is t, it specifies the position of the last visible glyph in WINDOW. | ||
| 528 | POS defaults to point in WINDOW; WINDOW defaults to the selected window. | ||
| 529 | 483 | ||
| 530 | If POS is visible, return t if PARTIALLY is nil; if PARTIALLY is non-nil, | 484 | If the value returned by this function is non-nil, resizing and deleting |
| 531 | return value is a list of 2 or 6 elements (X Y [RTOP RBOT ROWH VPOS]), | 485 | WINDOW may resize all windows in the same combination. */) |
| 532 | where X and Y are the pixel coordinates relative to the top left corner | 486 | (Lisp_Object window) |
| 533 | of the window. The remaining elements are omitted if the character after | ||
| 534 | POS is fully visible; otherwise, RTOP and RBOT are the number of pixels | ||
| 535 | off-window at the top and bottom of the row, ROWH is the height of the | ||
| 536 | display row, and VPOS is the row number (0-based) containing POS. */) | ||
| 537 | (Lisp_Object pos, Lisp_Object window, Lisp_Object partially) | ||
| 538 | { | 487 | { |
| 539 | register struct window *w; | 488 | return decode_any_window (window)->splits; |
| 540 | register EMACS_INT posint; | ||
| 541 | register struct buffer *buf; | ||
| 542 | struct text_pos top; | ||
| 543 | Lisp_Object in_window = Qnil; | ||
| 544 | int rtop, rbot, rowh, vpos, fully_p = 1; | ||
| 545 | int x, y; | ||
| 546 | |||
| 547 | w = decode_window (window); | ||
| 548 | buf = XBUFFER (w->buffer); | ||
| 549 | SET_TEXT_POS_FROM_MARKER (top, w->start); | ||
| 550 | |||
| 551 | if (EQ (pos, Qt)) | ||
| 552 | posint = -1; | ||
| 553 | else if (!NILP (pos)) | ||
| 554 | { | ||
| 555 | CHECK_NUMBER_COERCE_MARKER (pos); | ||
| 556 | posint = XINT (pos); | ||
| 557 | } | ||
| 558 | else if (w == XWINDOW (selected_window)) | ||
| 559 | posint = PT; | ||
| 560 | else | ||
| 561 | posint = XMARKER (w->pointm)->charpos; | ||
| 562 | |||
| 563 | /* If position is above window start or outside buffer boundaries, | ||
| 564 | or if window start is out of range, position is not visible. */ | ||
| 565 | if ((EQ (pos, Qt) | ||
| 566 | || (posint >= CHARPOS (top) && posint <= BUF_ZV (buf))) | ||
| 567 | && CHARPOS (top) >= BUF_BEGV (buf) | ||
| 568 | && CHARPOS (top) <= BUF_ZV (buf) | ||
| 569 | && pos_visible_p (w, posint, &x, &y, &rtop, &rbot, &rowh, &vpos) | ||
| 570 | && (fully_p = !rtop && !rbot, (!NILP (partially) || fully_p))) | ||
| 571 | in_window = Qt; | ||
| 572 | |||
| 573 | if (!NILP (in_window) && !NILP (partially)) | ||
| 574 | { | ||
| 575 | Lisp_Object part = Qnil; | ||
| 576 | if (!fully_p) | ||
| 577 | part = list4 (make_number (rtop), make_number (rbot), | ||
| 578 | make_number (rowh), make_number (vpos)); | ||
| 579 | in_window = Fcons (make_number (x), | ||
| 580 | Fcons (make_number (y), part)); | ||
| 581 | } | ||
| 582 | |||
| 583 | return in_window; | ||
| 584 | } | 489 | } |
| 585 | 490 | ||
| 586 | DEFUN ("window-line-height", Fwindow_line_height, | 491 | DEFUN ("set-window-splits", Fset_window_splits, Sset_window_splits, 2, 2, 0, |
| 587 | Swindow_line_height, 0, 2, 0, | 492 | doc: /* Set splits status of WINDOW to STATUS. |
| 588 | doc: /* Return height in pixels of text line LINE in window WINDOW. | 493 | WINDOW can be any window and defaults to the selected one. Return |
| 589 | If WINDOW is nil or omitted, use selected window. | 494 | STATUS. |
| 590 | 495 | ||
| 591 | Return height of current line if LINE is omitted or nil. Return height of | 496 | If STATUS is nil and WINDOW is later resized, the corresponding space is |
| 592 | header or mode line if LINE is `header-line' and `mode-line'. | 497 | preferably taken from (or given to) WINDOW's right sibling. When WINDOW |
| 593 | Otherwise, LINE is a text line number starting from 0. A negative number | 498 | is deleted, its space is given to its left sibling. |
| 594 | counts from the end of the window. | ||
| 595 | 499 | ||
| 596 | Value is a list (HEIGHT VPOS YPOS OFFBOT), where HEIGHT is the height | 500 | If STATUS is non-nil, resizing and deleting WINDOW may resize all |
| 597 | in pixels of the visible part of the line, VPOS and YPOS are the | 501 | windows in the same combination. */) |
| 598 | vertical position in lines and pixels of the line, relative to the top | 502 | (Lisp_Object window, Lisp_Object status) |
| 599 | of the first text line, and OFFBOT is the number of off-window pixels at | ||
| 600 | the bottom of the text line. If there are off-window pixels at the top | ||
| 601 | of the (first) text line, YPOS is negative. | ||
| 602 | |||
| 603 | Return nil if window display is not up-to-date. In that case, use | ||
| 604 | `pos-visible-in-window-p' to obtain the information. */) | ||
| 605 | (Lisp_Object line, Lisp_Object window) | ||
| 606 | { | 503 | { |
| 607 | register struct window *w; | 504 | register struct window *w = decode_any_window (window); |
| 608 | register struct buffer *b; | ||
| 609 | struct glyph_row *row, *end_row; | ||
| 610 | int max_y, crop, i, n; | ||
| 611 | |||
| 612 | w = decode_window (window); | ||
| 613 | |||
| 614 | if (noninteractive | ||
| 615 | || w->pseudo_window_p) | ||
| 616 | return Qnil; | ||
| 617 | |||
| 618 | CHECK_BUFFER (w->buffer); | ||
| 619 | b = XBUFFER (w->buffer); | ||
| 620 | 505 | ||
| 621 | /* Fail if current matrix is not up-to-date. */ | 506 | w->splits = status; |
| 622 | if (NILP (w->window_end_valid) | ||
| 623 | || current_buffer->clip_changed | ||
| 624 | || current_buffer->prevent_redisplay_optimizations_p | ||
| 625 | || XFASTINT (w->last_modified) < BUF_MODIFF (b) | ||
| 626 | || XFASTINT (w->last_overlay_modified) < BUF_OVERLAY_MODIFF (b)) | ||
| 627 | return Qnil; | ||
| 628 | 507 | ||
| 629 | if (NILP (line)) | 508 | return w->splits; |
| 630 | { | 509 | } |
| 631 | i = w->cursor.vpos; | ||
| 632 | if (i < 0 || i >= w->current_matrix->nrows | ||
| 633 | || (row = MATRIX_ROW (w->current_matrix, i), !row->enabled_p)) | ||
| 634 | return Qnil; | ||
| 635 | max_y = window_text_bottom_y (w); | ||
| 636 | goto found_row; | ||
| 637 | } | ||
| 638 | 510 | ||
| 639 | if (EQ (line, Qheader_line)) | 511 | DEFUN ("window-nest", Fwindow_nest, Swindow_nest, 0, 1, 0, |
| 640 | { | 512 | doc: /* Return nest status of WINDOW. |
| 641 | if (!WINDOW_WANTS_HEADER_LINE_P (w)) | 513 | WINDOW can be any window and defaults to the selected one. |
| 642 | return Qnil; | ||
| 643 | row = MATRIX_HEADER_LINE_ROW (w->current_matrix); | ||
| 644 | if (!row->enabled_p) | ||
| 645 | return Qnil; | ||
| 646 | return list4 (make_number (row->height), | ||
| 647 | make_number (0), make_number (0), | ||
| 648 | make_number (0)); | ||
| 649 | } | ||
| 650 | 514 | ||
| 651 | if (EQ (line, Qmode_line)) | 515 | If the return value is nil, subwindows of WINDOW can be recombined with |
| 652 | { | 516 | WINDOW's siblings. A return value of non-nil means that subwindows of |
| 653 | row = MATRIX_MODE_LINE_ROW (w->current_matrix); | 517 | WINDOW are never \(re-)combined with WINDOW's siblings. */) |
| 654 | if (!row->enabled_p) | 518 | (Lisp_Object window) |
| 655 | return Qnil; | 519 | { |
| 656 | return list4 (make_number (row->height), | 520 | return decode_any_window (window)->nest; |
| 657 | make_number (0), /* not accurate */ | 521 | } |
| 658 | make_number (WINDOW_HEADER_LINE_HEIGHT (w) | ||
| 659 | + window_text_bottom_y (w)), | ||
| 660 | make_number (0)); | ||
| 661 | } | ||
| 662 | 522 | ||
| 663 | CHECK_NUMBER (line); | 523 | DEFUN ("set-window-nest", Fset_window_nest, Sset_window_nest, 2, 2, 0, |
| 664 | n = XINT (line); | 524 | doc: /* Set nest status of WINDOW to STATUS. |
| 525 | WINDOW can be any window and defaults to the selected one. Return | ||
| 526 | STATUS. | ||
| 665 | 527 | ||
| 666 | row = MATRIX_FIRST_TEXT_ROW (w->current_matrix); | 528 | If STATUS is nil, subwindows of WINDOW can be recombined with WINDOW's |
| 667 | end_row = MATRIX_BOTTOM_TEXT_ROW (w->current_matrix, w); | 529 | siblings. STATUS non-nil means that subwindows of WINDOW are never |
| 668 | max_y = window_text_bottom_y (w); | 530 | \(re-)combined with WINDOW's siblings. */) |
| 669 | i = 0; | 531 | (Lisp_Object window, Lisp_Object status) |
| 532 | { | ||
| 533 | register struct window *w = decode_any_window (window); | ||
| 670 | 534 | ||
| 671 | while ((n < 0 || i < n) | 535 | w->nest = status; |
| 672 | && row <= end_row && row->enabled_p | ||
| 673 | && row->y + row->height < max_y) | ||
| 674 | row++, i++; | ||
| 675 | 536 | ||
| 676 | if (row > end_row || !row->enabled_p) | 537 | return w->nest; |
| 677 | return Qnil; | 538 | } |
| 678 | |||
| 679 | if (++n < 0) | ||
| 680 | { | ||
| 681 | if (-n > i) | ||
| 682 | return Qnil; | ||
| 683 | row += n; | ||
| 684 | i += n; | ||
| 685 | } | ||
| 686 | 539 | ||
| 687 | found_row: | 540 | DEFUN ("window-use-time", Fwindow_use_time, Swindow_use_time, 0, 1, 0, |
| 688 | crop = max (0, (row->y + row->height) - max_y); | 541 | doc: /* Return WINDOW's use time. |
| 689 | return list4 (make_number (row->height + min (0, row->y) - crop), | 542 | WINDOW defaults to the selected window. The window with the highest use |
| 690 | make_number (i), | 543 | time is the most recently selected one. The window with the lowest use |
| 691 | make_number (row->y), | 544 | time is the least recently selected one. */) |
| 692 | make_number (crop)); | 545 | (Lisp_Object window) |
| 546 | { | ||
| 547 | return decode_window (window)->use_time; | ||
| 693 | } | 548 | } |
| 694 | 549 | ||
| 695 | DEFUN ("window-total-size", Fwindow_total_size, Swindow_total_size, 0, 2, 0, | 550 | DEFUN ("window-total-size", Fwindow_total_size, Swindow_total_size, 0, 2, 0, |
| @@ -714,6 +569,34 @@ first child otherwise. */) | |||
| 714 | return decode_any_window (window)->total_cols; | 569 | return decode_any_window (window)->total_cols; |
| 715 | } | 570 | } |
| 716 | 571 | ||
| 572 | DEFUN ("window-new-total", Fwindow_new_total, Swindow_new_total, 0, 1, 0, | ||
| 573 | doc: /* Return new total size of WINDOW. | ||
| 574 | WINDOW defaults to the selected window. */) | ||
| 575 | (Lisp_Object window) | ||
| 576 | { | ||
| 577 | return decode_any_window (window)->new_total; | ||
| 578 | } | ||
| 579 | |||
| 580 | DEFUN ("window-normal-size", Fwindow_normal_size, Swindow_normal_size, 0, 2, 0, | ||
| 581 | doc: /* Return normal height of WINDOW. | ||
| 582 | WINDOW can be any window and defaults to the selected one. Optional | ||
| 583 | argument HORIZONTAL non-nil means return normal width of WINDOW. */) | ||
| 584 | (Lisp_Object window, Lisp_Object horizontal) | ||
| 585 | { | ||
| 586 | if (NILP (horizontal)) | ||
| 587 | return decode_any_window (window)->normal_lines; | ||
| 588 | else | ||
| 589 | return decode_any_window (window)->normal_cols; | ||
| 590 | } | ||
| 591 | |||
| 592 | DEFUN ("window-new-normal", Fwindow_new_normal, Swindow_new_normal, 0, 1, 0, | ||
| 593 | doc: /* Return new normal size of WINDOW. | ||
| 594 | WINDOW can be any window and defaults to the selected one. */) | ||
| 595 | (Lisp_Object window) | ||
| 596 | { | ||
| 597 | return decode_any_window (window)->new_normal; | ||
| 598 | } | ||
| 599 | |||
| 717 | DEFUN ("window-left-column", Fwindow_left_column, Swindow_left_column, 0, 1, 0, | 600 | DEFUN ("window-left-column", Fwindow_left_column, Swindow_left_column, 0, 1, 0, |
| 718 | doc: /* Return left column of WINDOW. | 601 | doc: /* Return left column of WINDOW. |
| 719 | WINDOW can be any window and defaults to the selected one. */) | 602 | WINDOW can be any window and defaults to the selected one. */) |
| @@ -802,7 +685,7 @@ WINDOW's fringes or display margins either. */) | |||
| 802 | 685 | ||
| 803 | DEFUN ("window-hscroll", Fwindow_hscroll, Swindow_hscroll, 0, 1, 0, | 686 | DEFUN ("window-hscroll", Fwindow_hscroll, Swindow_hscroll, 0, 1, 0, |
| 804 | doc: /* Return the number of columns by which WINDOW is scrolled from left margin. | 687 | doc: /* Return the number of columns by which WINDOW is scrolled from left margin. |
| 805 | WINDOW defaults to the selected window. */) | 688 | WINDOW must be a live window and defaults to the selected one. */) |
| 806 | (Lisp_Object window) | 689 | (Lisp_Object window) |
| 807 | { | 690 | { |
| 808 | return decode_window (window)->hscroll; | 691 | return decode_window (window)->hscroll; |
| @@ -1372,7 +1255,7 @@ window_from_coordinates (struct frame *f, int x, int y, | |||
| 1372 | 1255 | ||
| 1373 | DEFUN ("window-at", Fwindow_at, Swindow_at, 2, 3, 0, | 1256 | DEFUN ("window-at", Fwindow_at, Swindow_at, 2, 3, 0, |
| 1374 | doc: /* Return window containing coordinates X and Y on FRAME. | 1257 | doc: /* Return window containing coordinates X and Y on FRAME. |
| 1375 | If omitted, FRAME defaults to the currently selected frame. | 1258 | FRAME must be a live frame and defaults to the selected one. |
| 1376 | The top left corner of the frame is considered to be row 0, | 1259 | The top left corner of the frame is considered to be row 0, |
| 1377 | column 0. */) | 1260 | column 0. */) |
| 1378 | (Lisp_Object x, Lisp_Object y, Lisp_Object frame) | 1261 | (Lisp_Object x, Lisp_Object y, Lisp_Object frame) |
| @@ -1398,7 +1281,7 @@ column 0. */) | |||
| 1398 | 1281 | ||
| 1399 | DEFUN ("window-point", Fwindow_point, Swindow_point, 0, 1, 0, | 1282 | DEFUN ("window-point", Fwindow_point, Swindow_point, 0, 1, 0, |
| 1400 | doc: /* Return current value of point in WINDOW. | 1283 | doc: /* Return current value of point in WINDOW. |
| 1401 | WINDOW defaults to the selected window. | 1284 | WINDOW must be a live window and defaults to the selected one. |
| 1402 | 1285 | ||
| 1403 | For a nonselected window, this is the value point would have | 1286 | For a nonselected window, this is the value point would have |
| 1404 | if that window were selected. | 1287 | if that window were selected. |
| @@ -1420,7 +1303,7 @@ But that is hard to define. */) | |||
| 1420 | 1303 | ||
| 1421 | DEFUN ("window-start", Fwindow_start, Swindow_start, 0, 1, 0, | 1304 | DEFUN ("window-start", Fwindow_start, Swindow_start, 0, 1, 0, |
| 1422 | doc: /* Return position at which display currently starts in WINDOW. | 1305 | doc: /* Return position at which display currently starts in WINDOW. |
| 1423 | WINDOW defaults to the selected window. | 1306 | WINDOW must be a live window and defaults to the selected one. |
| 1424 | This is updated by redisplay or by calling `set-window-start'. */) | 1307 | This is updated by redisplay or by calling `set-window-start'. */) |
| 1425 | (Lisp_Object window) | 1308 | (Lisp_Object window) |
| 1426 | { | 1309 | { |
| @@ -1440,7 +1323,7 @@ have been if redisplay had finished, do this: | |||
| 1440 | 1323 | ||
| 1441 | DEFUN ("window-end", Fwindow_end, Swindow_end, 0, 2, 0, | 1324 | DEFUN ("window-end", Fwindow_end, Swindow_end, 0, 2, 0, |
| 1442 | doc: /* Return position at which display currently ends in WINDOW. | 1325 | doc: /* Return position at which display currently ends in WINDOW. |
| 1443 | WINDOW defaults to the selected window. | 1326 | WINDOW must be a live window and defaults to the selected one. |
| 1444 | This is updated by redisplay, when it runs to completion. | 1327 | This is updated by redisplay, when it runs to completion. |
| 1445 | Simply changing the buffer text or setting `window-start' | 1328 | Simply changing the buffer text or setting `window-start' |
| 1446 | does not update this value. | 1329 | does not update this value. |
| @@ -1559,6 +1442,179 @@ overriding motion of point in order to display at this exact start. */) | |||
| 1559 | return pos; | 1442 | return pos; |
| 1560 | } | 1443 | } |
| 1561 | 1444 | ||
| 1445 | DEFUN ("pos-visible-in-window-p", Fpos_visible_in_window_p, | ||
| 1446 | Spos_visible_in_window_p, 0, 3, 0, | ||
| 1447 | doc: /* Return non-nil if position POS is currently on the frame in WINDOW. | ||
| 1448 | Return nil if that position is scrolled vertically out of view. | ||
| 1449 | If a character is only partially visible, nil is returned, unless the | ||
| 1450 | optional argument PARTIALLY is non-nil. | ||
| 1451 | If POS is only out of view because of horizontal scrolling, return non-nil. | ||
| 1452 | If POS is t, it specifies the position of the last visible glyph in WINDOW. | ||
| 1453 | POS defaults to point in WINDOW; WINDOW defaults to the selected window. | ||
| 1454 | |||
| 1455 | If POS is visible, return t if PARTIALLY is nil; if PARTIALLY is non-nil, | ||
| 1456 | return value is a list of 2 or 6 elements (X Y [RTOP RBOT ROWH VPOS]), | ||
| 1457 | where X and Y are the pixel coordinates relative to the top left corner | ||
| 1458 | of the window. The remaining elements are omitted if the character after | ||
| 1459 | POS is fully visible; otherwise, RTOP and RBOT are the number of pixels | ||
| 1460 | off-window at the top and bottom of the row, ROWH is the height of the | ||
| 1461 | display row, and VPOS is the row number (0-based) containing POS. */) | ||
| 1462 | (Lisp_Object pos, Lisp_Object window, Lisp_Object partially) | ||
| 1463 | { | ||
| 1464 | register struct window *w; | ||
| 1465 | register EMACS_INT posint; | ||
| 1466 | register struct buffer *buf; | ||
| 1467 | struct text_pos top; | ||
| 1468 | Lisp_Object in_window = Qnil; | ||
| 1469 | int rtop, rbot, rowh, vpos, fully_p = 1; | ||
| 1470 | int x, y; | ||
| 1471 | |||
| 1472 | w = decode_window (window); | ||
| 1473 | buf = XBUFFER (w->buffer); | ||
| 1474 | SET_TEXT_POS_FROM_MARKER (top, w->start); | ||
| 1475 | |||
| 1476 | if (EQ (pos, Qt)) | ||
| 1477 | posint = -1; | ||
| 1478 | else if (!NILP (pos)) | ||
| 1479 | { | ||
| 1480 | CHECK_NUMBER_COERCE_MARKER (pos); | ||
| 1481 | posint = XINT (pos); | ||
| 1482 | } | ||
| 1483 | else if (w == XWINDOW (selected_window)) | ||
| 1484 | posint = PT; | ||
| 1485 | else | ||
| 1486 | posint = XMARKER (w->pointm)->charpos; | ||
| 1487 | |||
| 1488 | /* If position is above window start or outside buffer boundaries, | ||
| 1489 | or if window start is out of range, position is not visible. */ | ||
| 1490 | if ((EQ (pos, Qt) | ||
| 1491 | || (posint >= CHARPOS (top) && posint <= BUF_ZV (buf))) | ||
| 1492 | && CHARPOS (top) >= BUF_BEGV (buf) | ||
| 1493 | && CHARPOS (top) <= BUF_ZV (buf) | ||
| 1494 | && pos_visible_p (w, posint, &x, &y, &rtop, &rbot, &rowh, &vpos) | ||
| 1495 | && (fully_p = !rtop && !rbot, (!NILP (partially) || fully_p))) | ||
| 1496 | in_window = Qt; | ||
| 1497 | |||
| 1498 | if (!NILP (in_window) && !NILP (partially)) | ||
| 1499 | { | ||
| 1500 | Lisp_Object part = Qnil; | ||
| 1501 | if (!fully_p) | ||
| 1502 | part = list4 (make_number (rtop), make_number (rbot), | ||
| 1503 | make_number (rowh), make_number (vpos)); | ||
| 1504 | in_window = Fcons (make_number (x), | ||
| 1505 | Fcons (make_number (y), part)); | ||
| 1506 | } | ||
| 1507 | |||
| 1508 | return in_window; | ||
| 1509 | } | ||
| 1510 | |||
| 1511 | DEFUN ("window-line-height", Fwindow_line_height, | ||
| 1512 | Swindow_line_height, 0, 2, 0, | ||
| 1513 | doc: /* Return height in pixels of text line LINE in window WINDOW. | ||
| 1514 | WINDOW defaults to the selected window. | ||
| 1515 | |||
| 1516 | Return height of current line if LINE is omitted or nil. Return height of | ||
| 1517 | header or mode line if LINE is `header-line' or `mode-line'. | ||
| 1518 | Otherwise, LINE is a text line number starting from 0. A negative number | ||
| 1519 | counts from the end of the window. | ||
| 1520 | |||
| 1521 | Value is a list (HEIGHT VPOS YPOS OFFBOT), where HEIGHT is the height | ||
| 1522 | in pixels of the visible part of the line, VPOS and YPOS are the | ||
| 1523 | vertical position in lines and pixels of the line, relative to the top | ||
| 1524 | of the first text line, and OFFBOT is the number of off-window pixels at | ||
| 1525 | the bottom of the text line. If there are off-window pixels at the top | ||
| 1526 | of the (first) text line, YPOS is negative. | ||
| 1527 | |||
| 1528 | Return nil if window display is not up-to-date. In that case, use | ||
| 1529 | `pos-visible-in-window-p' to obtain the information. */) | ||
| 1530 | (Lisp_Object line, Lisp_Object window) | ||
| 1531 | { | ||
| 1532 | register struct window *w; | ||
| 1533 | register struct buffer *b; | ||
| 1534 | struct glyph_row *row, *end_row; | ||
| 1535 | int max_y, crop, i, n; | ||
| 1536 | |||
| 1537 | w = decode_window (window); | ||
| 1538 | |||
| 1539 | if (noninteractive || w->pseudo_window_p) | ||
| 1540 | return Qnil; | ||
| 1541 | |||
| 1542 | CHECK_BUFFER (w->buffer); | ||
| 1543 | b = XBUFFER (w->buffer); | ||
| 1544 | |||
| 1545 | /* Fail if current matrix is not up-to-date. */ | ||
| 1546 | if (NILP (w->window_end_valid) | ||
| 1547 | || current_buffer->clip_changed | ||
| 1548 | || current_buffer->prevent_redisplay_optimizations_p | ||
| 1549 | || XFASTINT (w->last_modified) < BUF_MODIFF (b) | ||
| 1550 | || XFASTINT (w->last_overlay_modified) < BUF_OVERLAY_MODIFF (b)) | ||
| 1551 | return Qnil; | ||
| 1552 | |||
| 1553 | if (NILP (line)) | ||
| 1554 | { | ||
| 1555 | i = w->cursor.vpos; | ||
| 1556 | if (i < 0 || i >= w->current_matrix->nrows | ||
| 1557 | || (row = MATRIX_ROW (w->current_matrix, i), !row->enabled_p)) | ||
| 1558 | return Qnil; | ||
| 1559 | max_y = window_text_bottom_y (w); | ||
| 1560 | goto found_row; | ||
| 1561 | } | ||
| 1562 | |||
| 1563 | if (EQ (line, Qheader_line)) | ||
| 1564 | { | ||
| 1565 | if (!WINDOW_WANTS_HEADER_LINE_P (w)) | ||
| 1566 | return Qnil; | ||
| 1567 | row = MATRIX_HEADER_LINE_ROW (w->current_matrix); | ||
| 1568 | if (!row->enabled_p) | ||
| 1569 | return Qnil; | ||
| 1570 | return list4 (make_number (row->height), | ||
| 1571 | make_number (0), make_number (0), | ||
| 1572 | make_number (0)); | ||
| 1573 | } | ||
| 1574 | |||
| 1575 | if (EQ (line, Qmode_line)) | ||
| 1576 | { | ||
| 1577 | row = MATRIX_MODE_LINE_ROW (w->current_matrix); | ||
| 1578 | if (!row->enabled_p) | ||
| 1579 | return Qnil; | ||
| 1580 | return list4 (make_number (row->height), | ||
| 1581 | make_number (0), /* not accurate */ | ||
| 1582 | make_number (WINDOW_HEADER_LINE_HEIGHT (w) | ||
| 1583 | + window_text_bottom_y (w)), | ||
| 1584 | make_number (0)); | ||
| 1585 | } | ||
| 1586 | |||
| 1587 | CHECK_NUMBER (line); | ||
| 1588 | n = XINT (line); | ||
| 1589 | |||
| 1590 | row = MATRIX_FIRST_TEXT_ROW (w->current_matrix); | ||
| 1591 | end_row = MATRIX_BOTTOM_TEXT_ROW (w->current_matrix, w); | ||
| 1592 | max_y = window_text_bottom_y (w); | ||
| 1593 | i = 0; | ||
| 1594 | |||
| 1595 | while ((n < 0 || i < n) | ||
| 1596 | && row <= end_row && row->enabled_p | ||
| 1597 | && row->y + row->height < max_y) | ||
| 1598 | row++, i++; | ||
| 1599 | |||
| 1600 | if (row > end_row || !row->enabled_p) | ||
| 1601 | return Qnil; | ||
| 1602 | |||
| 1603 | if (++n < 0) | ||
| 1604 | { | ||
| 1605 | if (-n > i) | ||
| 1606 | return Qnil; | ||
| 1607 | row += n; | ||
| 1608 | i += n; | ||
| 1609 | } | ||
| 1610 | |||
| 1611 | found_row: | ||
| 1612 | crop = max (0, (row->y + row->height) - max_y); | ||
| 1613 | return list4 (make_number (row->height + min (0, row->y) - crop), | ||
| 1614 | make_number (i), | ||
| 1615 | make_number (row->y), | ||
| 1616 | make_number (crop)); | ||
| 1617 | } | ||
| 1562 | 1618 | ||
| 1563 | DEFUN ("window-dedicated-p", Fwindow_dedicated_p, Swindow_dedicated_p, | 1619 | DEFUN ("window-dedicated-p", Fwindow_dedicated_p, Swindow_dedicated_p, |
| 1564 | 0, 1, 0, | 1620 | 0, 1, 0, |
| @@ -1586,22 +1642,22 @@ is the value returned by `window-dedicated-p' is t. */) | |||
| 1586 | DEFUN ("set-window-dedicated-p", Fset_window_dedicated_p, | 1642 | DEFUN ("set-window-dedicated-p", Fset_window_dedicated_p, |
| 1587 | Sset_window_dedicated_p, 2, 2, 0, | 1643 | Sset_window_dedicated_p, 2, 2, 0, |
| 1588 | doc: /* Mark WINDOW as dedicated according to FLAG. | 1644 | doc: /* Mark WINDOW as dedicated according to FLAG. |
| 1589 | WINDOW defaults to the selected window. FLAG non-nil means mark WINDOW | 1645 | WINDOW must be a live window and defaults to the selected one. FLAG |
| 1590 | as dedicated to its buffer. FLAG nil means mark WINDOW as non-dedicated. | 1646 | non-nil means mark WINDOW as dedicated to its buffer. FLAG nil means |
| 1591 | Return FLAG. | 1647 | mark WINDOW as non-dedicated. Return FLAG. |
| 1592 | 1648 | ||
| 1593 | When a window is dedicated to its buffer, `display-buffer' will refrain | 1649 | When a window is dedicated to its buffer, `display-buffer' will refrain |
| 1594 | from displaying another buffer in it. `get-lru-window' and | 1650 | from displaying another buffer in it. `get-lru-window' and |
| 1595 | `get-largest-window' treat dedicated windows specially. | 1651 | `get-largest-window' treat dedicated windows specially. |
| 1596 | `delete-windows-on', `replace-buffer-in-windows', `quit-window' and | 1652 | `delete-windows-on', `replace-buffer-in-windows', `quit-window', |
| 1597 | `kill-buffer' can delete a dedicated window and the containing | 1653 | `quit-restore-window' and `kill-buffer' can delete a dedicated window |
| 1598 | frame. | 1654 | and the containing frame. |
| 1599 | 1655 | ||
| 1600 | As a special case, if FLAG is t, mark WINDOW as "strongly" dedicated to | 1656 | As a special case, if FLAG is t, mark WINDOW as "strongly" dedicated to |
| 1601 | its buffer. Functions like `set-window-buffer' may change the buffer | 1657 | its buffer. Functions like `set-window-buffer' may change the buffer |
| 1602 | displayed by a window, unless that window is strongly dedicated to its | 1658 | displayed by a window, unless that window is strongly dedicated to its |
| 1603 | buffer. If and when `set-window-buffer' displays another buffer in a | 1659 | buffer. If and when `set-window-buffer' displays another buffer in a |
| 1604 | window, it also makes sure that the window is not marked as dedicated. */) | 1660 | window, it also makes sure that the window is no more dedicated. */) |
| 1605 | (Lisp_Object window, Lisp_Object flag) | 1661 | (Lisp_Object window, Lisp_Object flag) |
| 1606 | { | 1662 | { |
| 1607 | register struct window *w = decode_window (window); | 1663 | register struct window *w = decode_window (window); |
| @@ -1610,6 +1666,52 @@ window, it also makes sure that the window is not marked as dedicated. */) | |||
| 1610 | return w->dedicated; | 1666 | return w->dedicated; |
| 1611 | } | 1667 | } |
| 1612 | 1668 | ||
| 1669 | DEFUN ("window-prev-buffers", Fwindow_prev_buffers, Swindow_prev_buffers, | ||
| 1670 | 0, 1, 0, | ||
| 1671 | doc: /* Return buffers previously shown in WINDOW. | ||
| 1672 | WINDOW must be a live window and defaults to the selected one. | ||
| 1673 | |||
| 1674 | The return value is either nil or a list of <buffer, window-start, | ||
| 1675 | window-point> triples where buffer was previously shown in WINDOW. */) | ||
| 1676 | (Lisp_Object window) | ||
| 1677 | { | ||
| 1678 | return decode_window (window)->prev_buffers; | ||
| 1679 | } | ||
| 1680 | |||
| 1681 | DEFUN ("set-window-prev-buffers", Fset_window_prev_buffers, | ||
| 1682 | Sset_window_prev_buffers, 2, 2, 0, | ||
| 1683 | doc: /* Set WINDOW's previous buffers to PREV-BUFFERS. | ||
| 1684 | WINDOW must be a live window and defaults to the selected one. Return | ||
| 1685 | PREV-BUFFERS. | ||
| 1686 | |||
| 1687 | PREV-BUFFERS should be either nil or a list of <buffer, window-start, | ||
| 1688 | window-point> triples where buffer was previously shown in WINDOW. */) | ||
| 1689 | (Lisp_Object window, Lisp_Object prev_buffers) | ||
| 1690 | { | ||
| 1691 | return decode_any_window (window)->prev_buffers = prev_buffers; | ||
| 1692 | } | ||
| 1693 | |||
| 1694 | DEFUN ("window-next-buffers", Fwindow_next_buffers, Swindow_next_buffers, | ||
| 1695 | 0, 1, 0, | ||
| 1696 | doc: /* Return list of buffers recently re-shown in WINDOW. | ||
| 1697 | WINDOW must be a live window and defaults to the selected one. */) | ||
| 1698 | (Lisp_Object window) | ||
| 1699 | { | ||
| 1700 | return decode_window (window)->next_buffers; | ||
| 1701 | } | ||
| 1702 | |||
| 1703 | DEFUN ("set-window-next-buffers", Fset_window_next_buffers, | ||
| 1704 | Sset_window_next_buffers, 2, 2, 0, | ||
| 1705 | doc: /* Set WINDOW's next buffers to NEXT-BUFFERS. | ||
| 1706 | WINDOW must be a live window and defaults to the selected one. Return | ||
| 1707 | NEXT-BUFFERS. | ||
| 1708 | |||
| 1709 | NEXT-BUFFERS should be either nil or a list of buffers that have been | ||
| 1710 | recently re-shown in WINDOW. */) | ||
| 1711 | (Lisp_Object window, Lisp_Object next_buffers) | ||
| 1712 | { | ||
| 1713 | return decode_any_window (window)->next_buffers = next_buffers; | ||
| 1714 | } | ||
| 1613 | 1715 | ||
| 1614 | DEFUN ("window-parameters", Fwindow_parameters, Swindow_parameters, | 1716 | DEFUN ("window-parameters", Fwindow_parameters, Swindow_parameters, |
| 1615 | 0, 1, 0, | 1717 | 0, 1, 0, |
| @@ -1618,7 +1720,7 @@ WINDOW defaults to the selected window. The return value is a list of | |||
| 1618 | elements of the form (PARAMETER . VALUE). */) | 1720 | elements of the form (PARAMETER . VALUE). */) |
| 1619 | (Lisp_Object window) | 1721 | (Lisp_Object window) |
| 1620 | { | 1722 | { |
| 1621 | return Fcopy_alist (decode_window (window)->window_parameters); | 1723 | return Fcopy_alist (decode_any_window (window)->window_parameters); |
| 1622 | } | 1724 | } |
| 1623 | 1725 | ||
| 1624 | DEFUN ("window-parameter", Fwindow_parameter, Swindow_parameter, | 1726 | DEFUN ("window-parameter", Fwindow_parameter, Swindow_parameter, |
| @@ -1629,7 +1731,7 @@ WINDOW defaults to the selected window. */) | |||
| 1629 | { | 1731 | { |
| 1630 | Lisp_Object result; | 1732 | Lisp_Object result; |
| 1631 | 1733 | ||
| 1632 | result = Fassq (parameter, decode_window (window)->window_parameters); | 1734 | result = Fassq (parameter, decode_any_window (window)->window_parameters); |
| 1633 | return CDR_SAFE (result); | 1735 | return CDR_SAFE (result); |
| 1634 | } | 1736 | } |
| 1635 | 1737 | ||
| @@ -1639,7 +1741,7 @@ DEFUN ("set-window-parameter", Fset_window_parameter, | |||
| 1639 | WINDOW defaults to the selected window. Return VALUE. */) | 1741 | WINDOW defaults to the selected window. Return VALUE. */) |
| 1640 | (Lisp_Object window, Lisp_Object parameter, Lisp_Object value) | 1742 | (Lisp_Object window, Lisp_Object parameter, Lisp_Object value) |
| 1641 | { | 1743 | { |
| 1642 | register struct window *w = decode_window (window); | 1744 | register struct window *w = decode_any_window (window); |
| 1643 | Lisp_Object old_alist_elt; | 1745 | Lisp_Object old_alist_elt; |
| 1644 | 1746 | ||
| 1645 | old_alist_elt = Fassq (parameter, w->window_parameters); | 1747 | old_alist_elt = Fassq (parameter, w->window_parameters); |
| @@ -1650,7 +1752,6 @@ WINDOW defaults to the selected window. Return VALUE. */) | |||
| 1650 | return value; | 1752 | return value; |
| 1651 | } | 1753 | } |
| 1652 | 1754 | ||
| 1653 | |||
| 1654 | DEFUN ("window-display-table", Fwindow_display_table, Swindow_display_table, | 1755 | DEFUN ("window-display-table", Fwindow_display_table, Swindow_display_table, |
| 1655 | 0, 1, 0, | 1756 | 0, 1, 0, |
| 1656 | doc: /* Return the display-table that WINDOW is using. | 1757 | doc: /* Return the display-table that WINDOW is using. |
| @@ -2033,7 +2134,7 @@ delete_window (register Lisp_Object window) | |||
| 2033 | 2134 | ||
| 2034 | /* Add window W to *USER_DATA. USER_DATA is actually a Lisp_Object | 2135 | /* Add window W to *USER_DATA. USER_DATA is actually a Lisp_Object |
| 2035 | pointer. This is a callback function for foreach_window, used in | 2136 | pointer. This is a callback function for foreach_window, used in |
| 2036 | function window_list. */ | 2137 | the window_list function. */ |
| 2037 | 2138 | ||
| 2038 | static int | 2139 | static int |
| 2039 | add_window_to_list (struct window *w, void *user_data) | 2140 | add_window_to_list (struct window *w, void *user_data) |
| @@ -2662,26 +2763,25 @@ check_all_windows (void) | |||
| 2662 | window_loop (CHECK_ALL_WINDOWS, Qnil, 1, Qt); | 2763 | window_loop (CHECK_ALL_WINDOWS, Qnil, 1, Qt); |
| 2663 | } | 2764 | } |
| 2664 | 2765 | ||
| 2665 | DEFUN ("window-use-time", Fwindow_use_time, Swindow_use_time, 0, 1, 0, | ||
| 2666 | doc: /* Return WINDOW's use time. | ||
| 2667 | WINDOW defaults to the selected window. The window with the highest use | ||
| 2668 | time is the most recently selected one. The window with the lowest use | ||
| 2669 | time is the least recently selected one. */) | ||
| 2670 | (Lisp_Object window) | ||
| 2671 | { | ||
| 2672 | return decode_window (window)->use_time; | ||
| 2673 | } | ||
| 2674 | |||
| 2675 | DEFUN ("get-buffer-window", Fget_buffer_window, Sget_buffer_window, 0, 2, 0, | 2766 | DEFUN ("get-buffer-window", Fget_buffer_window, Sget_buffer_window, 0, 2, 0, |
| 2676 | doc: /* Return a window currently displaying BUFFER-OR-NAME, or nil if none. | 2767 | doc: /* Return a window currently displaying BUFFER-OR-NAME, or nil if none. |
| 2677 | BUFFER-OR-NAME may be a buffer or a buffer name and defaults to the | 2768 | BUFFER-OR-NAME may be a buffer or a buffer name and defaults to |
| 2678 | current buffer. | 2769 | the current buffer. |
| 2679 | If optional argument FRAME is `visible', search all visible frames. | 2770 | |
| 2680 | If optional argument FRAME is 0, search all visible and iconified frames. | 2771 | The optional argument ALL-FRAMES specifies the frames to consider: |
| 2681 | If FRAME is t, search all frames. | 2772 | |
| 2682 | If FRAME is nil, search only the selected frame. | 2773 | - t means consider all windows on all existing frames. |
| 2683 | If FRAME is a frame, search only that frame. */) | 2774 | |
| 2684 | (Lisp_Object buffer_or_name, Lisp_Object frame) | 2775 | - `visible' means consider all windows on all visible frames. |
| 2776 | |||
| 2777 | - 0 (the number zero) means consider all windows on all visible | ||
| 2778 | and iconified frames. | ||
| 2779 | |||
| 2780 | - A frame means consider all windows on that frame only. | ||
| 2781 | |||
| 2782 | Any other value of ALL-FRAMES means consider all windows on the | ||
| 2783 | selected frame and no others. */) | ||
| 2784 | (Lisp_Object buffer_or_name, Lisp_Object all_frames) | ||
| 2685 | { | 2785 | { |
| 2686 | Lisp_Object buffer; | 2786 | Lisp_Object buffer; |
| 2687 | 2787 | ||
| @@ -2691,7 +2791,7 @@ If FRAME is a frame, search only that frame. */) | |||
| 2691 | buffer = Fget_buffer (buffer_or_name); | 2791 | buffer = Fget_buffer (buffer_or_name); |
| 2692 | 2792 | ||
| 2693 | if (BUFFERP (buffer)) | 2793 | if (BUFFERP (buffer)) |
| 2694 | return window_loop (GET_BUFFER_WINDOW, buffer, 1, frame); | 2794 | return window_loop (GET_BUFFER_WINDOW, buffer, 1, all_frames); |
| 2695 | else | 2795 | else |
| 2696 | return Qnil; | 2796 | return Qnil; |
| 2697 | } | 2797 | } |
| @@ -3723,6 +3823,17 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int | |||
| 3723 | unbind_to (count, Qnil); | 3823 | unbind_to (count, Qnil); |
| 3724 | } | 3824 | } |
| 3725 | 3825 | ||
| 3826 | DEFUN ("set-window-clone-number", Fset_window_clone_number, Sset_window_clone_number, 2, 2, 0, | ||
| 3827 | doc: /* Set WINDOW's clone number to CLONE-NUMBER. | ||
| 3828 | WINDOW can be any window and defaults to the selected one. */) | ||
| 3829 | (Lisp_Object window, Lisp_Object clone_number) | ||
| 3830 | { | ||
| 3831 | register struct window *w = decode_any_window (window); | ||
| 3832 | |||
| 3833 | CHECK_NUMBER (clone_number); | ||
| 3834 | w->clone_number = clone_number; | ||
| 3835 | return w->clone_number; | ||
| 3836 | } | ||
| 3726 | 3837 | ||
| 3727 | DEFUN ("set-window-buffer", Fset_window_buffer, Sset_window_buffer, 2, 3, 0, | 3838 | DEFUN ("set-window-buffer", Fset_window_buffer, Sset_window_buffer, 2, 3, 0, |
| 3728 | doc: /* Make WINDOW display BUFFER-OR-NAME as its contents. | 3839 | doc: /* Make WINDOW display BUFFER-OR-NAME as its contents. |
| @@ -3912,6 +4023,7 @@ make_dummy_parent (Lisp_Object window) | |||
| 3912 | 4023 | ||
| 3913 | ++sequence_number; | 4024 | ++sequence_number; |
| 3914 | XSETFASTINT (p->sequence_number, sequence_number); | 4025 | XSETFASTINT (p->sequence_number, sequence_number); |
| 4026 | XSETFASTINT (p->clone_number, sequence_number); | ||
| 3915 | 4027 | ||
| 3916 | /* Put new into window structure in place of window */ | 4028 | /* Put new into window structure in place of window */ |
| 3917 | replace_window (window, new); | 4029 | replace_window (window, new); |
| @@ -3925,6 +4037,112 @@ make_dummy_parent (Lisp_Object window) | |||
| 3925 | p->start = Qnil; | 4037 | p->start = Qnil; |
| 3926 | p->pointm = Qnil; | 4038 | p->pointm = Qnil; |
| 3927 | p->buffer = Qnil; | 4039 | p->buffer = Qnil; |
| 4040 | |||
| 4041 | p->splits = Qnil; | ||
| 4042 | p->nest = Qnil; | ||
| 4043 | p->window_parameters = Qnil; | ||
| 4044 | |||
| 4045 | } | ||
| 4046 | |||
| 4047 | /* Make new window from scratch. */ | ||
| 4048 | Lisp_Object | ||
| 4049 | make_window (void) | ||
| 4050 | { | ||
| 4051 | Lisp_Object window; | ||
| 4052 | register struct window *w; | ||
| 4053 | |||
| 4054 | w = allocate_window (); | ||
| 4055 | /* Initialize all Lisp data. */ | ||
| 4056 | w->frame = w->mini_p = Qnil; | ||
| 4057 | w->next = w->prev = w->hchild = w->vchild = w->parent = Qnil; | ||
| 4058 | XSETFASTINT (w->left_col, 0); | ||
| 4059 | XSETFASTINT (w->top_line, 0); | ||
| 4060 | XSETFASTINT (w->total_lines, 0); | ||
| 4061 | XSETFASTINT (w->total_cols, 0); | ||
| 4062 | w->normal_lines = make_float (1.0); | ||
| 4063 | w->normal_cols = make_float (1.0); | ||
| 4064 | XSETFASTINT (w->new_total, 0); | ||
| 4065 | XSETFASTINT (w->new_normal, 0); | ||
| 4066 | w->buffer = Qnil; | ||
| 4067 | w->start = Fmake_marker (); | ||
| 4068 | w->pointm = Fmake_marker (); | ||
| 4069 | w->force_start = w->optional_new_start = Qnil; | ||
| 4070 | XSETFASTINT (w->hscroll, 0); | ||
| 4071 | XSETFASTINT (w->min_hscroll, 0); | ||
| 4072 | XSETFASTINT (w->use_time, 0); | ||
| 4073 | ++sequence_number; | ||
| 4074 | XSETFASTINT (w->sequence_number, sequence_number); | ||
| 4075 | XSETFASTINT (w->clone_number, sequence_number); | ||
| 4076 | w->temslot = w->last_modified = w->last_overlay_modified = Qnil; | ||
| 4077 | XSETFASTINT (w->last_point, 0); | ||
| 4078 | w->last_had_star = w->vertical_scroll_bar = Qnil; | ||
| 4079 | w->left_margin_cols = w->right_margin_cols = Qnil; | ||
| 4080 | w->left_fringe_width = w->right_fringe_width = Qnil; | ||
| 4081 | w->fringes_outside_margins = Qnil; | ||
| 4082 | w->scroll_bar_width = Qnil; | ||
| 4083 | w->vertical_scroll_bar_type = Qt; | ||
| 4084 | w->last_mark_x = w->last_mark_y = Qnil; | ||
| 4085 | XSETFASTINT (w->window_end_pos, 0); | ||
| 4086 | XSETFASTINT (w->window_end_vpos, 0); | ||
| 4087 | w->window_end_valid = w->update_mode_line = Qnil; | ||
| 4088 | w->start_at_line_beg = w->display_table = w->dedicated = Qnil; | ||
| 4089 | w->base_line_number = w->base_line_pos = w->region_showing = Qnil; | ||
| 4090 | w->column_number_displayed = w->redisplay_end_trigger = Qnil; | ||
| 4091 | w->splits = w->nest = w->window_parameters = Qnil; | ||
| 4092 | w->prev_buffers = w->next_buffers = Qnil; | ||
| 4093 | /* Initialize non-Lisp data. */ | ||
| 4094 | w->desired_matrix = w->current_matrix = 0; | ||
| 4095 | w->nrows_scale_factor = w->ncols_scale_factor = 1; | ||
| 4096 | memset (&w->cursor, 0, sizeof (w->cursor)); | ||
| 4097 | memset (&w->last_cursor, 0, sizeof (w->last_cursor)); | ||
| 4098 | memset (&w->phys_cursor, 0, sizeof (w->phys_cursor)); | ||
| 4099 | w->phys_cursor_type = -1; | ||
| 4100 | w->phys_cursor_width = -1; | ||
| 4101 | w->last_cursor_off_p = w->cursor_off_p = 0; | ||
| 4102 | w->must_be_updated_p = 0; | ||
| 4103 | w->pseudo_window_p = 0; | ||
| 4104 | w->frozen_window_start_p = 0; | ||
| 4105 | w->vscroll = 0; | ||
| 4106 | w->resize_proportionally = Qnil; | ||
| 4107 | /* Reset window_list. */ | ||
| 4108 | Vwindow_list = Qnil; | ||
| 4109 | /* Return window. */ | ||
| 4110 | XSETWINDOW (window, w); | ||
| 4111 | return window; | ||
| 4112 | } | ||
| 4113 | |||
| 4114 | DEFUN ("set-window-new-total", Fset_window_new_total, Sset_window_new_total, 2, 3, 0, | ||
| 4115 | doc: /* Set new total size of WINDOW to SIZE. | ||
| 4116 | Return SIZE. | ||
| 4117 | |||
| 4118 | Optional argument ADD non-nil means add SIZE to the new total size of | ||
| 4119 | WINDOW and return the sum. | ||
| 4120 | |||
| 4121 | Note: This function does not operate on any subwindows of WINDOW. */) | ||
| 4122 | (Lisp_Object window, Lisp_Object size, Lisp_Object add) | ||
| 4123 | { | ||
| 4124 | struct window *w = decode_any_window (window); | ||
| 4125 | |||
| 4126 | CHECK_NUMBER (size); | ||
| 4127 | if (NILP (add)) | ||
| 4128 | XSETINT (w->new_total, XINT (size)); | ||
| 4129 | else | ||
| 4130 | XSETINT (w->new_total, XINT (w->new_total) + XINT (size)); | ||
| 4131 | |||
| 4132 | return w->new_total; | ||
| 4133 | } | ||
| 4134 | |||
| 4135 | DEFUN ("set-window-new-normal", Fset_window_new_normal, Sset_window_new_normal, 1, 2, 0, | ||
| 4136 | doc: /* Set new normal size of WINDOW to SIZE. | ||
| 4137 | Return SIZE. | ||
| 4138 | |||
| 4139 | Note: This function does not operate on any subwindows of WINDOW. */) | ||
| 4140 | (Lisp_Object window, Lisp_Object size) | ||
| 4141 | { | ||
| 4142 | struct window *w = decode_any_window (window); | ||
| 4143 | |||
| 4144 | w->new_normal = size; | ||
| 4145 | return w->new_normal; | ||
| 3928 | } | 4146 | } |
| 3929 | 4147 | ||
| 3930 | DEFUN ("split-window", Fsplit_window, Ssplit_window, 0, 3, "", | 4148 | DEFUN ("split-window", Fsplit_window, Ssplit_window, 0, 3, "", |
| @@ -5970,9 +6188,11 @@ struct save_window_data | |||
| 5970 | struct saved_window | 6188 | struct saved_window |
| 5971 | { | 6189 | { |
| 5972 | struct vectorlike_header header; | 6190 | struct vectorlike_header header; |
| 5973 | Lisp_Object window; | 6191 | |
| 6192 | Lisp_Object window, clone_number; | ||
| 5974 | Lisp_Object buffer, start, pointm, mark; | 6193 | Lisp_Object buffer, start, pointm, mark; |
| 5975 | Lisp_Object left_col, top_line, total_cols, total_lines; | 6194 | Lisp_Object left_col, top_line, total_cols, total_lines; |
| 6195 | Lisp_Object normal_cols, normal_lines; | ||
| 5976 | Lisp_Object hscroll, min_hscroll; | 6196 | Lisp_Object hscroll, min_hscroll; |
| 5977 | Lisp_Object parent, prev; | 6197 | Lisp_Object parent, prev; |
| 5978 | Lisp_Object start_at_line_beg; | 6198 | Lisp_Object start_at_line_beg; |
| @@ -5982,6 +6202,7 @@ struct saved_window | |||
| 5982 | Lisp_Object left_fringe_width, right_fringe_width, fringes_outside_margins; | 6202 | Lisp_Object left_fringe_width, right_fringe_width, fringes_outside_margins; |
| 5983 | Lisp_Object scroll_bar_width, vertical_scroll_bar_type; | 6203 | Lisp_Object scroll_bar_width, vertical_scroll_bar_type; |
| 5984 | Lisp_Object dedicated, resize_proportionally; | 6204 | Lisp_Object dedicated, resize_proportionally; |
| 6205 | Lisp_Object splits, nest, window_parameters; | ||
| 5985 | }; | 6206 | }; |
| 5986 | 6207 | ||
| 5987 | #define SAVED_WINDOW_N(swv,n) \ | 6208 | #define SAVED_WINDOW_N(swv,n) \ |
| @@ -6186,6 +6407,7 @@ the return value is nil. Otherwise the value is t. */) | |||
| 6186 | } | 6407 | } |
| 6187 | } | 6408 | } |
| 6188 | 6409 | ||
| 6410 | w->clone_number = p->clone_number; | ||
| 6189 | /* If we squirreled away the buffer in the window's height, | 6411 | /* If we squirreled away the buffer in the window's height, |
| 6190 | restore it now. */ | 6412 | restore it now. */ |
| 6191 | if (BUFFERP (w->total_lines)) | 6413 | if (BUFFERP (w->total_lines)) |
| @@ -6194,6 +6416,8 @@ the return value is nil. Otherwise the value is t. */) | |||
| 6194 | w->top_line = p->top_line; | 6416 | w->top_line = p->top_line; |
| 6195 | w->total_cols = p->total_cols; | 6417 | w->total_cols = p->total_cols; |
| 6196 | w->total_lines = p->total_lines; | 6418 | w->total_lines = p->total_lines; |
| 6419 | w->normal_cols = p->normal_cols; | ||
| 6420 | w->normal_lines = p->normal_lines; | ||
| 6197 | w->hscroll = p->hscroll; | 6421 | w->hscroll = p->hscroll; |
| 6198 | w->min_hscroll = p->min_hscroll; | 6422 | w->min_hscroll = p->min_hscroll; |
| 6199 | w->display_table = p->display_table; | 6423 | w->display_table = p->display_table; |
| @@ -6207,6 +6431,9 @@ the return value is nil. Otherwise the value is t. */) | |||
| 6207 | w->scroll_bar_width = p->scroll_bar_width; | 6431 | w->scroll_bar_width = p->scroll_bar_width; |
| 6208 | w->vertical_scroll_bar_type = p->vertical_scroll_bar_type; | 6432 | w->vertical_scroll_bar_type = p->vertical_scroll_bar_type; |
| 6209 | w->dedicated = p->dedicated; | 6433 | w->dedicated = p->dedicated; |
| 6434 | w->splits = p->splits; | ||
| 6435 | w->nest = p->nest; | ||
| 6436 | w->window_parameters = p->window_parameters; | ||
| 6210 | w->resize_proportionally = p->resize_proportionally; | 6437 | w->resize_proportionally = p->resize_proportionally; |
| 6211 | XSETFASTINT (w->last_modified, 0); | 6438 | XSETFASTINT (w->last_modified, 0); |
| 6212 | XSETFASTINT (w->last_overlay_modified, 0); | 6439 | XSETFASTINT (w->last_overlay_modified, 0); |
| @@ -6445,11 +6672,14 @@ save_window_save (Lisp_Object window, struct Lisp_Vector *vector, int i) | |||
| 6445 | 6672 | ||
| 6446 | XSETFASTINT (w->temslot, i); i++; | 6673 | XSETFASTINT (w->temslot, i); i++; |
| 6447 | p->window = window; | 6674 | p->window = window; |
| 6675 | p->clone_number = w->clone_number; | ||
| 6448 | p->buffer = w->buffer; | 6676 | p->buffer = w->buffer; |
| 6449 | p->left_col = w->left_col; | 6677 | p->left_col = w->left_col; |
| 6450 | p->top_line = w->top_line; | 6678 | p->top_line = w->top_line; |
| 6451 | p->total_cols = w->total_cols; | 6679 | p->total_cols = w->total_cols; |
| 6452 | p->total_lines = w->total_lines; | 6680 | p->total_lines = w->total_lines; |
| 6681 | p->normal_cols = w->normal_cols; | ||
| 6682 | p->normal_lines = w->normal_lines; | ||
| 6453 | p->hscroll = w->hscroll; | 6683 | p->hscroll = w->hscroll; |
| 6454 | p->min_hscroll = w->min_hscroll; | 6684 | p->min_hscroll = w->min_hscroll; |
| 6455 | p->display_table = w->display_table; | 6685 | p->display_table = w->display_table; |
| @@ -6463,7 +6693,10 @@ save_window_save (Lisp_Object window, struct Lisp_Vector *vector, int i) | |||
| 6463 | p->scroll_bar_width = w->scroll_bar_width; | 6693 | p->scroll_bar_width = w->scroll_bar_width; |
| 6464 | p->vertical_scroll_bar_type = w->vertical_scroll_bar_type; | 6694 | p->vertical_scroll_bar_type = w->vertical_scroll_bar_type; |
| 6465 | p->dedicated = w->dedicated; | 6695 | p->dedicated = w->dedicated; |
| 6696 | p->splits = w->splits; | ||
| 6697 | p->nest = w->nest; | ||
| 6466 | p->resize_proportionally = w->resize_proportionally; | 6698 | p->resize_proportionally = w->resize_proportionally; |
| 6699 | p->window_parameters = w->window_parameters; | ||
| 6467 | if (!NILP (w->buffer)) | 6700 | if (!NILP (w->buffer)) |
| 6468 | { | 6701 | { |
| 6469 | /* Save w's value of point in the window configuration. | 6702 | /* Save w's value of point in the window configuration. |
| @@ -7281,16 +7514,26 @@ frame to be redrawn only if it is a tty frame. */); | |||
| 7281 | defsubr (&Sset_frame_selected_window); | 7514 | defsubr (&Sset_frame_selected_window); |
| 7282 | defsubr (&Spos_visible_in_window_p); | 7515 | defsubr (&Spos_visible_in_window_p); |
| 7283 | defsubr (&Swindow_line_height); | 7516 | defsubr (&Swindow_line_height); |
| 7517 | defsubr (&Swindow_clone_number); | ||
| 7284 | defsubr (&Swindow_buffer); | 7518 | defsubr (&Swindow_buffer); |
| 7285 | defsubr (&Swindow_parent); | 7519 | defsubr (&Swindow_parent); |
| 7286 | defsubr (&Swindow_vchild); | 7520 | defsubr (&Swindow_vchild); |
| 7287 | defsubr (&Swindow_hchild); | 7521 | defsubr (&Swindow_hchild); |
| 7288 | defsubr (&Swindow_next); | 7522 | defsubr (&Swindow_next); |
| 7289 | defsubr (&Swindow_prev); | 7523 | defsubr (&Swindow_prev); |
| 7524 | defsubr (&Swindow_splits); | ||
| 7525 | defsubr (&Sset_window_splits); | ||
| 7526 | defsubr (&Swindow_nest); | ||
| 7527 | defsubr (&Sset_window_nest); | ||
| 7290 | defsubr (&Swindow_use_time); | 7528 | defsubr (&Swindow_use_time); |
| 7291 | defsubr (&Swindow_top_line); | 7529 | defsubr (&Swindow_top_line); |
| 7292 | defsubr (&Swindow_left_column); | 7530 | defsubr (&Swindow_left_column); |
| 7293 | defsubr (&Swindow_total_size); | 7531 | defsubr (&Swindow_total_size); |
| 7532 | defsubr (&Swindow_normal_size); | ||
| 7533 | defsubr (&Swindow_new_total); | ||
| 7534 | defsubr (&Swindow_new_normal); | ||
| 7535 | defsubr (&Sset_window_new_total); | ||
| 7536 | defsubr (&Sset_window_new_normal); | ||
| 7294 | defsubr (&Swindow_body_size); | 7537 | defsubr (&Swindow_body_size); |
| 7295 | defsubr (&Swindow_hscroll); | 7538 | defsubr (&Swindow_hscroll); |
| 7296 | defsubr (&Sset_window_hscroll); | 7539 | defsubr (&Sset_window_hscroll); |
| @@ -7322,6 +7565,7 @@ frame to be redrawn only if it is a tty frame. */); | |||
| 7322 | defsubr (&Sreplace_buffer_in_windows); | 7565 | defsubr (&Sreplace_buffer_in_windows); |
| 7323 | defsubr (&Sdelete_window); | 7566 | defsubr (&Sdelete_window); |
| 7324 | defsubr (&Sset_window_buffer); | 7567 | defsubr (&Sset_window_buffer); |
| 7568 | defsubr (&Sset_window_clone_number); | ||
| 7325 | defsubr (&Sselect_window); | 7569 | defsubr (&Sselect_window); |
| 7326 | defsubr (&Sforce_window_update); | 7570 | defsubr (&Sforce_window_update); |
| 7327 | defsubr (&Stemp_output_buffer_show); | 7571 | defsubr (&Stemp_output_buffer_show); |
| @@ -7355,6 +7599,10 @@ frame to be redrawn only if it is a tty frame. */); | |||
| 7355 | defsubr (&Scompare_window_configurations); | 7599 | defsubr (&Scompare_window_configurations); |
| 7356 | defsubr (&Swindow_list); | 7600 | defsubr (&Swindow_list); |
| 7357 | defsubr (&Swindow_list_1); | 7601 | defsubr (&Swindow_list_1); |
| 7602 | defsubr (&Swindow_prev_buffers); | ||
| 7603 | defsubr (&Sset_window_prev_buffers); | ||
| 7604 | defsubr (&Swindow_next_buffers); | ||
| 7605 | defsubr (&Sset_window_next_buffers); | ||
| 7358 | defsubr (&Swindow_parameters); | 7606 | defsubr (&Swindow_parameters); |
| 7359 | defsubr (&Swindow_parameter); | 7607 | defsubr (&Swindow_parameter); |
| 7360 | defsubr (&Sset_window_parameter); | 7608 | defsubr (&Sset_window_parameter); |