aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2011-06-08 14:36:31 -0700
committerPaul Eggert2011-06-08 14:36:31 -0700
commit8692a7dea5aa8796a59be6335323c68d78ec5749 (patch)
tree24f83e436a2d8259187ab9e5b9684f6473503089 /src
parent9c4c5f81ceb3fb3100a6a81adffcf764b843363c (diff)
parent7e2aa385adee11a135231dba9d11cd47ffbc8ff1 (diff)
downloademacs-8692a7dea5aa8796a59be6335323c68d78ec5749.tar.gz
emacs-8692a7dea5aa8796a59be6335323c68d78ec5749.zip
Merge from trunk.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog66
-rw-r--r--src/frame.c2
-rw-r--r--src/indent.c8
-rw-r--r--src/window.c1154
-rw-r--r--src/window.h119
5 files changed, 878 insertions, 471 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 100a7b0f000..f54d40db392 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -48,12 +48,74 @@
48 All uses of STRING_BYTES_MAX replaced by STRING_BYTES_BOUND. 48 All uses of STRING_BYTES_MAX replaced by STRING_BYTES_BOUND.
49 * lisp.h (STRING_BYTES_BOUND): Renamed from STRING_BYTES_MAX. 49 * lisp.h (STRING_BYTES_BOUND): Renamed from STRING_BYTES_MAX.
50 50
512011-06-07 Paul Eggert <eggert@cs.ucla.edu>
52
53 * character.c (string_escape_byte8): Fix nbytes/nchars typo. 51 * character.c (string_escape_byte8): Fix nbytes/nchars typo.
54 52
55 * alloc.c (Fmake_string): Check for out-of-range init. 53 * alloc.c (Fmake_string): Check for out-of-range init.
56 54
552011-06-08 Martin Rudalics <rudalics@gmx.at>
56
57 * window.h (window): Add some new members to window structure -
58 normal_lines, normal_cols, new_total, new_normal, clone_number,
59 splits, nest, prev_buffers, next_buffers.
60 (WINDOW_TOTAL_SIZE): Move here from window.c.
61 (MIN_SAFE_WINDOW_WIDTH, MIN_SAFE_WINDOW_HEIGHT): Define here.
62
63 * window.c (Fwindow_height, Fwindow_width, Fwindow_full_width_p):
64 Remove.
65 (make_dummy_parent): Set new members of windows structure.
66 (make_window): Move down in code. Handle new members of window
67 structure.
68 (Fwindow_clone_number, Fwindow_splits, Fset_window_splits)
69 (Fwindow_nest, Fset_window_nest, Fwindow_new_total)
70 (Fwindow_normal_size, Fwindow_new_normal, Fwindow_prev_buffers)
71 (Fset_window_prev_buffers, Fwindow_next_buffers)
72 (Fset_window_next_buffers, Fset_window_clone_number): New
73 functions.
74 (Fwindow_hscroll, Fwindow_at, Fwindow_point, Fwindow_start)
75 (Fwindow_end, Fwindow_line_height, Fset_window_dedicated_p):
76 Doc-string fixes.
77 (Fwindow_parameters, Fwindow_parameter, Fset_window_parameter):
78 Argument WINDOW can be now internal window too.
79 (Fwindow_use_time): Move up in code.
80 (Fget_buffer_window): Rename argument FRAME to ALL-FRAMES.
81 Rewrite doc-string.
82 (Fset_window_configuration, saved_window)
83 (Fcurrent_window_configuration, save_window_save): Handle new
84 members of window structure.
85 (WINDOW_TOTAL_SIZE, MIN_SAFE_WINDOW_WIDTH)
86 (MIN_SAFE_WINDOW_HEIGHT): Move to window.h.
87 (syms_of_window): New Lisp objects Qrecord_window_buffer,
88 Qwindow_deletable_p, Qdelete_window, Qreplace_buffer_in_windows,
89 Qget_mru_window, Qresize_root_window,
90 Qresize_root_window_vertically, Qsafe, Qabove, Qbelow,
91 Qauto_buffer_name; staticpro them.
92
932011-06-07 Martin Rudalics <rudalics@gmx.at>
94
95 * window.c (Fwindow_total_size, Fwindow_left_column)
96 (Fwindow_top_line, window_body_lines, Fwindow_body_size)
97 (Fwindow_list_1): New functions.
98 (window_box_text_cols): Replace with window_body_cols.
99 (Fwindow_width, Fscroll_left, Fscroll_right): Use
100 window_body_cols instead of window_box_text_cols.
101 (delete_window, Fset_window_configuration): Call
102 delete_all_subwindows with window as argument.
103 (delete_all_subwindows): Take a window as argument and not a
104 structure. Rewrite.
105 (window_loop): Remove handling of GET_LRU_WINDOW and
106 GET_LARGEST_WINDOW.
107 (Fget_lru_window, Fget_largest_window): Move to window.el.
108
109 * window.h: Extern window_body_cols instead of
110 window_box_text_cols. delete_all_subwindows now takes a
111 Lisp_Object as argument.
112
113 * indent.c (compute_motion, Fcompute_motion): Use
114 window_body_cols instead of window_box_text_cols.
115
116 * frame.c (delete_frame): Call delete_all_subwindows with root
117 window as argument.
118
572011-06-07 Daniel Colascione <dan.colascione@gmail.com> 1192011-06-07 Daniel Colascione <dan.colascione@gmail.com>
58 120
59 * fns.c (Fputhash): Document return value. 121 * fns.c (Fputhash): Document return value.
diff --git a/src/frame.c b/src/frame.c
index 68984a68d52..71881265b44 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -1336,7 +1336,7 @@ delete_frame (Lisp_Object frame, Lisp_Object force)
1336 1336
1337 /* Mark all the windows that used to be on FRAME as deleted, and then 1337 /* Mark all the windows that used to be on FRAME as deleted, and then
1338 remove the reference to them. */ 1338 remove the reference to them. */
1339 delete_all_subwindows (XWINDOW (f->root_window)); 1339 delete_all_subwindows (f->root_window);
1340 f->root_window = Qnil; 1340 f->root_window = Qnil;
1341 1341
1342 Vframe_list = Fdelq (frame, Vframe_list); 1342 Vframe_list = Fdelq (frame, Vframe_list);
diff --git a/src/indent.c b/src/indent.c
index 0fdc45a33a4..57a4548ef3c 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -1102,8 +1102,8 @@ static struct position val_compute_motion;
1102 WINDOW_HAS_VERTICAL_SCROLL_BAR (window) 1102 WINDOW_HAS_VERTICAL_SCROLL_BAR (window)
1103 and frame_cols = FRAME_COLS (XFRAME (window->frame)) 1103 and frame_cols = FRAME_COLS (XFRAME (window->frame))
1104 1104
1105 Or you can let window_box_text_cols do this all for you, and write: 1105 Or you can let window_body_cols do this all for you, and write:
1106 window_box_text_cols (w) - 1 1106 window_body_cols (w) - 1
1107 1107
1108 The `-1' accounts for the continuation-line backslashes; the rest 1108 The `-1' accounts for the continuation-line backslashes; the rest
1109 accounts for window borders if the window is split horizontally, and 1109 accounts for window borders if the window is split horizontally, and
@@ -1179,7 +1179,7 @@ compute_motion (EMACS_INT from, EMACS_INT fromvpos, EMACS_INT fromhpos, int did_
1179 /* Negative width means use all available text columns. */ 1179 /* Negative width means use all available text columns. */
1180 if (width < 0) 1180 if (width < 0)
1181 { 1181 {
1182 width = window_box_text_cols (win); 1182 width = window_body_cols (win);
1183 /* We must make room for continuation marks if we don't have fringes. */ 1183 /* We must make room for continuation marks if we don't have fringes. */
1184#ifdef HAVE_WINDOW_SYSTEM 1184#ifdef HAVE_WINDOW_SYSTEM
1185 if (!FRAME_WINDOW_P (XFRAME (win->frame))) 1185 if (!FRAME_WINDOW_P (XFRAME (win->frame)))
@@ -1792,7 +1792,7 @@ visible section of the buffer, and pass LINE and COL as TOPOS. */)
1792 ? window_internal_height (w) 1792 ? window_internal_height (w)
1793 : XINT (XCDR (topos))), 1793 : XINT (XCDR (topos))),
1794 (NILP (topos) 1794 (NILP (topos)
1795 ? (window_box_text_cols (w) 1795 ? (window_body_cols (w)
1796 - ( 1796 - (
1797#ifdef HAVE_WINDOW_SYSTEM 1797#ifdef HAVE_WINDOW_SYSTEM
1798 FRAME_WINDOW_P (XFRAME (w->frame)) ? 0 : 1798 FRAME_WINDOW_P (XFRAME (w->frame)) ? 0 :
diff --git a/src/window.c b/src/window.c
index 4e8b98a3237..393a2478ce1 100644
--- a/src/window.c
+++ b/src/window.c
@@ -51,9 +51,14 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
51#endif 51#endif
52 52
53Lisp_Object Qwindowp, Qwindow_live_p; 53Lisp_Object Qwindowp, Qwindow_live_p;
54static Lisp_Object Qwindow_configuration_p; 54static Lisp_Object Qwindow_configuration_p, Qrecord_window_buffer;
55static Lisp_Object Qdisplay_buffer; 55static Lisp_Object Qwindow_deletable_p, Qdelete_window, Qdisplay_buffer;
56static Lisp_Object Qreplace_buffer_in_windows, Qget_mru_window;
57static Lisp_Object Qresize_root_window, Qresize_root_window_vertically;
56static Lisp_Object Qscroll_up, Qscroll_down, Qscroll_command; 58static Lisp_Object Qscroll_up, Qscroll_down, Qscroll_command;
59static Lisp_Object Qsafe, Qabove, Qbelow;
60static Lisp_Object Qauto_buffer_name;
61
57static Lisp_Object Qwindow_size_fixed; 62static Lisp_Object Qwindow_size_fixed;
58 63
59static int displayed_window_lines (struct window *); 64static int displayed_window_lines (struct window *);
@@ -410,6 +415,14 @@ buffer of the selected window before each command. */)
410 return select_window (window, norecord, 0); 415 return select_window (window, norecord, 0);
411} 416}
412 417
418DEFUN ("window-clone-number", Fwindow_clone_number, Swindow_clone_number, 0, 1, 0,
419 doc: /* Return WINDOW's clone number.
420WINDOW can be any window and defaults to the selected one. */)
421 (Lisp_Object window)
422{
423 return decode_any_window (window)->clone_number;
424}
425
413DEFUN ("window-buffer", Fwindow_buffer, Swindow_buffer, 0, 1, 0, 426DEFUN ("window-buffer", Fwindow_buffer, Swindow_buffer, 0, 1, 0,
414 doc: /* Return the buffer that WINDOW is displaying. 427 doc: /* Return the buffer that WINDOW is displaying.
415WINDOW can be any window and defaults to the selected one. 428WINDOW can be any window and defaults to the selected one.
@@ -463,273 +476,221 @@ Return nil if WINDOW has no left sibling. */)
463{ 476{
464 return decode_any_window (window)->prev; 477 return decode_any_window (window)->prev;
465} 478}
466
467Lisp_Object
468make_window (void)
469{
470 Lisp_Object val;
471 register struct window *p;
472 479
473 p = allocate_window (); 480DEFUN ("window-splits", Fwindow_splits, Swindow_splits, 0, 1, 0,
474 ++sequence_number; 481 doc: /* Return splits status for WINDOW.
475 XSETFASTINT (p->sequence_number, sequence_number); 482WINDOW can be any window and defaults to the selected one.
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
516 Vwindow_list = Qnil;
517 return val;
518}
519 483
520DEFUN ("pos-visible-in-window-p", Fpos_visible_in_window_p, 484If the value returned by this function is nil and WINDOW is resized, the
521 Spos_visible_in_window_p, 0, 3, 0, 485corresponding 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. 486right sibling. When WINDOW is deleted, its space is given to its left
523Return nil if that position is scrolled vertically out of view. 487sibling.
524If a character is only partially visible, nil is returned, unless the
525optional argument PARTIALLY is non-nil.
526If POS is only out of view because of horizontal scrolling, return non-nil.
527If POS is t, it specifies the position of the last visible glyph in WINDOW.
528POS defaults to point in WINDOW; WINDOW defaults to the selected window.
529 488
530If POS is visible, return t if PARTIALLY is nil; if PARTIALLY is non-nil, 489If the value returned by this function is non-nil, resizing and deleting
531return value is a list of 2 or 6 elements (X Y [RTOP RBOT ROWH VPOS]), 490WINDOW may resize all windows in the same combination. */)
532where X and Y are the pixel coordinates relative to the top left corner 491 (Lisp_Object window)
533of the window. The remaining elements are omitted if the character after
534POS is fully visible; otherwise, RTOP and RBOT are the number of pixels
535off-window at the top and bottom of the row, ROWH is the height of the
536display row, and VPOS is the row number (0-based) containing POS. */)
537 (Lisp_Object pos, Lisp_Object window, Lisp_Object partially)
538{ 492{
539 register struct window *w; 493 return decode_any_window (window)->splits;
540 register EMACS_INT posint; 494}
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 495
547 w = decode_window (window); 496DEFUN ("set-window-splits", Fset_window_splits, Sset_window_splits, 2, 2, 0,
548 buf = XBUFFER (w->buffer); 497 doc: /* Set splits status of WINDOW to STATUS.
549 SET_TEXT_POS_FROM_MARKER (top, w->start); 498WINDOW can be any window and defaults to the selected one. Return
499STATUS.
550 500
551 if (EQ (pos, Qt)) 501If STATUS is nil and WINDOW is later resized, the corresponding space is
552 posint = -1; 502preferably taken from (or given to) WINDOW's right sibling. When WINDOW
553 else if (!NILP (pos)) 503is deleted, its space is given to its left sibling.
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 504
563 /* If position is above window start or outside buffer boundaries, 505If STATUS is non-nil, resizing and deleting WINDOW may resize all
564 or if window start is out of range, position is not visible. */ 506windows in the same combination. */)
565 if ((EQ (pos, Qt) 507 (Lisp_Object window, Lisp_Object status)
566 || (posint >= CHARPOS (top) && posint <= BUF_ZV (buf))) 508{
567 && CHARPOS (top) >= BUF_BEGV (buf) 509 register struct window *w = decode_any_window (window);
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 510
573 if (!NILP (in_window) && !NILP (partially)) 511 w->splits = status;
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 512
583 return in_window; 513 return w->splits;
584} 514}
585 515
586DEFUN ("window-line-height", Fwindow_line_height, 516DEFUN ("window-nest", Fwindow_nest, Swindow_nest, 0, 1, 0,
587 Swindow_line_height, 0, 2, 0, 517 doc: /* Return nest status of WINDOW.
588 doc: /* Return height in pixels of text line LINE in window WINDOW. 518WINDOW can be any window and defaults to the selected one.
589If WINDOW is nil or omitted, use selected window.
590 519
591Return height of current line if LINE is omitted or nil. Return height of 520If the return value is nil, subwindows of WINDOW can be recombined with
592header or mode line if LINE is `header-line' and `mode-line'. 521WINDOW's siblings. A return value of non-nil means that subwindows of
593Otherwise, LINE is a text line number starting from 0. A negative number 522WINDOW are never \(re-)combined with WINDOW's siblings. */)
594counts from the end of the window. 523 (Lisp_Object window)
524{
525 return decode_any_window (window)->nest;
526}
595 527
596Value is a list (HEIGHT VPOS YPOS OFFBOT), where HEIGHT is the height 528DEFUN ("set-window-nest", Fset_window_nest, Sset_window_nest, 2, 2, 0,
597in pixels of the visible part of the line, VPOS and YPOS are the 529 doc: /* Set nest status of WINDOW to STATUS.
598vertical position in lines and pixels of the line, relative to the top 530WINDOW can be any window and defaults to the selected one. Return
599of the first text line, and OFFBOT is the number of off-window pixels at 531STATUS.
600the bottom of the text line. If there are off-window pixels at the top
601of the (first) text line, YPOS is negative.
602 532
603Return nil if window display is not up-to-date. In that case, use 533If STATUS is nil, subwindows of WINDOW can be recombined with WINDOW's
604`pos-visible-in-window-p' to obtain the information. */) 534siblings. STATUS non-nil means that subwindows of WINDOW are never
605 (Lisp_Object line, Lisp_Object window) 535\(re-)combined with WINDOW's siblings. */)
536 (Lisp_Object window, Lisp_Object status)
606{ 537{
607 register struct window *w; 538 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 539
614 if (noninteractive 540 w->nest = status;
615 || w->pseudo_window_p)
616 return Qnil;
617 541
618 CHECK_BUFFER (w->buffer); 542 return w->nest;
619 b = XBUFFER (w->buffer); 543}
620 544
621 /* Fail if current matrix is not up-to-date. */ 545DEFUN ("window-use-time", Fwindow_use_time, Swindow_use_time, 0, 1, 0,
622 if (NILP (w->window_end_valid) 546 doc: /* Return WINDOW's use time.
623 || current_buffer->clip_changed 547WINDOW defaults to the selected window. The window with the highest use
624 || current_buffer->prevent_redisplay_optimizations_p 548time is the most recently selected one. The window with the lowest use
625 || XFASTINT (w->last_modified) < BUF_MODIFF (b) 549time is the least recently selected one. */)
626 || XFASTINT (w->last_overlay_modified) < BUF_OVERLAY_MODIFF (b)) 550 (Lisp_Object window)
627 return Qnil; 551{
552 return decode_window (window)->use_time;
553}
554
555DEFUN ("window-total-size", Fwindow_total_size, Swindow_total_size, 0, 2, 0,
556 doc: /* Return the total number of lines of WINDOW.
557WINDOW can be any window and defaults to the selected one. The return
558value includes WINDOW's mode line and header line, if any. If WINDOW
559is internal, the return value is the sum of the total number of lines
560of WINDOW's child windows if these are vertically combined and the
561height of WINDOW's first child otherwise.
562
563Optional argument HORIZONTAL non-nil means return the total number of
564columns of WINDOW. In this case the return value includes any vertical
565dividers or scrollbars of WINDOW. If WINDOW is internal, the return
566value is the sum of the total number of columns of WINDOW's child
567windows if they are horizontally combined and the width of WINDOW's
568first child otherwise. */)
569 (Lisp_Object window, Lisp_Object horizontal)
570{
571 if (NILP (horizontal))
572 return decode_any_window (window)->total_lines;
573 else
574 return decode_any_window (window)->total_cols;
575}
628 576
629 if (NILP (line)) 577DEFUN ("window-new-total", Fwindow_new_total, Swindow_new_total, 0, 1, 0,
630 { 578 doc: /* Return new total size of WINDOW.
631 i = w->cursor.vpos; 579WINDOW defaults to the selected window. */)
632 if (i < 0 || i >= w->current_matrix->nrows 580 (Lisp_Object window)
633 || (row = MATRIX_ROW (w->current_matrix, i), !row->enabled_p)) 581{
634 return Qnil; 582 return decode_any_window (window)->new_total;
635 max_y = window_text_bottom_y (w); 583}
636 goto found_row;
637 }
638 584
639 if (EQ (line, Qheader_line)) 585DEFUN ("window-normal-size", Fwindow_normal_size, Swindow_normal_size, 0, 2, 0,
640 { 586 doc: /* Return normal height of WINDOW.
641 if (!WINDOW_WANTS_HEADER_LINE_P (w)) 587WINDOW can be any window and defaults to the selected one. Optional
642 return Qnil; 588argument HORIZONTAL non-nil means return normal width of WINDOW. */)
643 row = MATRIX_HEADER_LINE_ROW (w->current_matrix); 589 (Lisp_Object window, Lisp_Object horizontal)
644 if (!row->enabled_p) 590{
645 return Qnil; 591 if (NILP (horizontal))
646 return list4 (make_number (row->height), 592 return decode_any_window (window)->normal_lines;
647 make_number (0), make_number (0), 593 else
648 make_number (0)); 594 return decode_any_window (window)->normal_cols;
649 } 595}
650 596
651 if (EQ (line, Qmode_line)) 597DEFUN ("window-new-normal", Fwindow_new_normal, Swindow_new_normal, 0, 1, 0,
652 { 598 doc: /* Return new normal size of WINDOW.
653 row = MATRIX_MODE_LINE_ROW (w->current_matrix); 599WINDOW can be any window and defaults to the selected one. */)
654 if (!row->enabled_p) 600 (Lisp_Object window)
655 return Qnil; 601{
656 return list4 (make_number (row->height), 602 return decode_any_window (window)->new_normal;
657 make_number (0), /* not accurate */ 603}
658 make_number (WINDOW_HEADER_LINE_HEIGHT (w)
659 + window_text_bottom_y (w)),
660 make_number (0));
661 }
662 604
663 CHECK_NUMBER (line); 605DEFUN ("window-left-column", Fwindow_left_column, Swindow_left_column, 0, 1, 0,
664 n = XINT (line); 606 doc: /* Return left column of WINDOW.
607WINDOW can be any window and defaults to the selected one. */)
608 (Lisp_Object window)
609{
610 return decode_any_window (window)->left_col;
611}
665 612
666 row = MATRIX_FIRST_TEXT_ROW (w->current_matrix); 613DEFUN ("window-top-line", Fwindow_top_line, Swindow_top_line, 0, 1, 0,
667 end_row = MATRIX_BOTTOM_TEXT_ROW (w->current_matrix, w); 614 doc: /* Return top line of WINDOW.
668 max_y = window_text_bottom_y (w); 615WINDOW can be any window and defaults to the selected one. */)
669 i = 0; 616 (Lisp_Object window)
617{
618 return decode_any_window (window)->top_line;
619}
670 620
671 while ((n < 0 || i < n) 621/* Return the number of lines of W's body. Don't count any mode or
672 && row <= end_row && row->enabled_p 622 header line of W. */
673 && row->y + row->height < max_y)
674 row++, i++;
675 623
676 if (row > end_row || !row->enabled_p) 624int
677 return Qnil; 625window_body_lines (struct window *w)
626{
627 int height = XFASTINT (w->total_lines);
678 628
679 if (++n < 0) 629 if (!MINI_WINDOW_P (w))
680 { 630 {
681 if (-n > i) 631 if (WINDOW_WANTS_MODELINE_P (w))
682 return Qnil; 632 --height;
683 row += n; 633 if (WINDOW_WANTS_HEADER_LINE_P (w))
684 i += n; 634 --height;
685 } 635 }
686 636
687 found_row: 637 return height;
688 crop = max (0, (row->y + row->height) - max_y);
689 return list4 (make_number (row->height + min (0, row->y) - crop),
690 make_number (i),
691 make_number (row->y),
692 make_number (crop));
693} 638}
694 639
640/* Return the number of columns of W's body. Don't count columns
641 occupied by the scroll bar or the vertical bar separating W from its
642 right sibling. On window-systems don't count fringes or display
643 margins either. */
695 644
696 645int
697DEFUN ("window-height", Fwindow_height, Swindow_height, 0, 1, 0, 646window_body_cols (struct window *w)
698 doc: /* Return the number of lines in WINDOW. 647{
699WINDOW defaults to the selected window. 648 struct frame *f = XFRAME (WINDOW_FRAME (w));
649 int width = XINT (w->total_cols);
650
651 if (WINDOW_HAS_VERTICAL_SCROLL_BAR (w))
652 /* Scroll bars occupy a few columns. */
653 width -= WINDOW_CONFIG_SCROLL_BAR_COLS (w);
654 else if (!FRAME_WINDOW_P (f)
655 && !WINDOW_RIGHTMOST_P (w) && !WINDOW_FULL_WIDTH_P (w))
656 /* The column of `|' characters separating side-by-side windows
657 occupies one column only. */
658 width -= 1;
700 659
701The return value includes WINDOW's mode line and header line, if any. 660 if (FRAME_WINDOW_P (f))
661 /* On window-systems, fringes and display margins cannot be
662 used for normal text. */
663 width -= (WINDOW_FRINGE_COLS (w)
664 + WINDOW_LEFT_MARGIN_COLS (w)
665 + WINDOW_RIGHT_MARGIN_COLS (w));
702 666
703Note: The function does not take into account the value of `line-spacing' 667 return width;
704when calculating the number of lines in WINDOW. */)
705 (Lisp_Object window)
706{
707 return decode_any_window (window)->total_lines;
708} 668}
709 669
710DEFUN ("window-width", Fwindow_width, Swindow_width, 0, 1, 0, 670DEFUN ("window-body-size", Fwindow_body_size, Swindow_body_size, 0, 2, 0,
711 doc: /* Return the number of display columns in WINDOW. 671 doc: /* Return the number of lines of WINDOW's body.
712WINDOW defaults to the selected window. 672WINDOW must be a live window and defaults to the selected one. The
673return value does not include WINDOW's mode line and header line, if
674any.
713 675
714Note: The return value is the number of columns available for text in 676Optional argument HORIZONTAL non-nil means return the number of columns
715WINDOW. If you want to find out how many columns WINDOW takes up, use 677of WINDOW's body. In this case, the return value does not include any
716(let ((edges (window-edges))) (- (nth 2 edges) (nth 0 edges))). */) 678vertical dividers or scroll bars owned by WINDOW. On a window-system
717 (Lisp_Object window) 679the return value does not include the number of columns used for
680WINDOW's fringes or display margins either. */)
681 (Lisp_Object window, Lisp_Object horizontal)
718{ 682{
719 return make_number (window_box_text_cols (decode_any_window (window))); 683 struct window *w = decode_any_window (window);
720}
721 684
722DEFUN ("window-full-width-p", Fwindow_full_width_p, Swindow_full_width_p, 0, 1, 0, 685 if (NILP (horizontal))
723 doc: /* Return t if WINDOW is as wide as its frame. 686 return make_number (window_body_lines (w));
724WINDOW defaults to the selected window. */) 687 else
725 (Lisp_Object window) 688 return make_number (window_body_cols (w));
726{
727 return WINDOW_FULL_WIDTH_P (decode_any_window (window)) ? Qt : Qnil;
728} 689}
729 690
730DEFUN ("window-hscroll", Fwindow_hscroll, Swindow_hscroll, 0, 1, 0, 691DEFUN ("window-hscroll", Fwindow_hscroll, Swindow_hscroll, 0, 1, 0,
731 doc: /* Return the number of columns by which WINDOW is scrolled from left margin. 692 doc: /* Return the number of columns by which WINDOW is scrolled from left margin.
732WINDOW defaults to the selected window. */) 693WINDOW must be a live window and defaults to the selected one. */)
733 (Lisp_Object window) 694 (Lisp_Object window)
734{ 695{
735 return decode_window (window)->hscroll; 696 return decode_window (window)->hscroll;
@@ -1299,7 +1260,7 @@ window_from_coordinates (struct frame *f, int x, int y,
1299 1260
1300DEFUN ("window-at", Fwindow_at, Swindow_at, 2, 3, 0, 1261DEFUN ("window-at", Fwindow_at, Swindow_at, 2, 3, 0,
1301 doc: /* Return window containing coordinates X and Y on FRAME. 1262 doc: /* Return window containing coordinates X and Y on FRAME.
1302If omitted, FRAME defaults to the currently selected frame. 1263FRAME must be a live frame and defaults to the selected one.
1303The top left corner of the frame is considered to be row 0, 1264The top left corner of the frame is considered to be row 0,
1304column 0. */) 1265column 0. */)
1305 (Lisp_Object x, Lisp_Object y, Lisp_Object frame) 1266 (Lisp_Object x, Lisp_Object y, Lisp_Object frame)
@@ -1325,7 +1286,7 @@ column 0. */)
1325 1286
1326DEFUN ("window-point", Fwindow_point, Swindow_point, 0, 1, 0, 1287DEFUN ("window-point", Fwindow_point, Swindow_point, 0, 1, 0,
1327 doc: /* Return current value of point in WINDOW. 1288 doc: /* Return current value of point in WINDOW.
1328WINDOW defaults to the selected window. 1289WINDOW must be a live window and defaults to the selected one.
1329 1290
1330For a nonselected window, this is the value point would have 1291For a nonselected window, this is the value point would have
1331if that window were selected. 1292if that window were selected.
@@ -1347,7 +1308,7 @@ But that is hard to define. */)
1347 1308
1348DEFUN ("window-start", Fwindow_start, Swindow_start, 0, 1, 0, 1309DEFUN ("window-start", Fwindow_start, Swindow_start, 0, 1, 0,
1349 doc: /* Return position at which display currently starts in WINDOW. 1310 doc: /* Return position at which display currently starts in WINDOW.
1350WINDOW defaults to the selected window. 1311WINDOW must be a live window and defaults to the selected one.
1351This is updated by redisplay or by calling `set-window-start'. */) 1312This is updated by redisplay or by calling `set-window-start'. */)
1352 (Lisp_Object window) 1313 (Lisp_Object window)
1353{ 1314{
@@ -1367,7 +1328,7 @@ have been if redisplay had finished, do this:
1367 1328
1368DEFUN ("window-end", Fwindow_end, Swindow_end, 0, 2, 0, 1329DEFUN ("window-end", Fwindow_end, Swindow_end, 0, 2, 0,
1369 doc: /* Return position at which display currently ends in WINDOW. 1330 doc: /* Return position at which display currently ends in WINDOW.
1370WINDOW defaults to the selected window. 1331WINDOW must be a live window and defaults to the selected one.
1371This is updated by redisplay, when it runs to completion. 1332This is updated by redisplay, when it runs to completion.
1372Simply changing the buffer text or setting `window-start' 1333Simply changing the buffer text or setting `window-start'
1373does not update this value. 1334does not update this value.
@@ -1486,6 +1447,179 @@ overriding motion of point in order to display at this exact start. */)
1486 return pos; 1447 return pos;
1487} 1448}
1488 1449
1450DEFUN ("pos-visible-in-window-p", Fpos_visible_in_window_p,
1451 Spos_visible_in_window_p, 0, 3, 0,
1452 doc: /* Return non-nil if position POS is currently on the frame in WINDOW.
1453Return nil if that position is scrolled vertically out of view.
1454If a character is only partially visible, nil is returned, unless the
1455optional argument PARTIALLY is non-nil.
1456If POS is only out of view because of horizontal scrolling, return non-nil.
1457If POS is t, it specifies the position of the last visible glyph in WINDOW.
1458POS defaults to point in WINDOW; WINDOW defaults to the selected window.
1459
1460If POS is visible, return t if PARTIALLY is nil; if PARTIALLY is non-nil,
1461return value is a list of 2 or 6 elements (X Y [RTOP RBOT ROWH VPOS]),
1462where X and Y are the pixel coordinates relative to the top left corner
1463of the window. The remaining elements are omitted if the character after
1464POS is fully visible; otherwise, RTOP and RBOT are the number of pixels
1465off-window at the top and bottom of the row, ROWH is the height of the
1466display row, and VPOS is the row number (0-based) containing POS. */)
1467 (Lisp_Object pos, Lisp_Object window, Lisp_Object partially)
1468{
1469 register struct window *w;
1470 register EMACS_INT posint;
1471 register struct buffer *buf;
1472 struct text_pos top;
1473 Lisp_Object in_window = Qnil;
1474 int rtop, rbot, rowh, vpos, fully_p = 1;
1475 int x, y;
1476
1477 w = decode_window (window);
1478 buf = XBUFFER (w->buffer);
1479 SET_TEXT_POS_FROM_MARKER (top, w->start);
1480
1481 if (EQ (pos, Qt))
1482 posint = -1;
1483 else if (!NILP (pos))
1484 {
1485 CHECK_NUMBER_COERCE_MARKER (pos);
1486 posint = XINT (pos);
1487 }
1488 else if (w == XWINDOW (selected_window))
1489 posint = PT;
1490 else
1491 posint = XMARKER (w->pointm)->charpos;
1492
1493 /* If position is above window start or outside buffer boundaries,
1494 or if window start is out of range, position is not visible. */
1495 if ((EQ (pos, Qt)
1496 || (posint >= CHARPOS (top) && posint <= BUF_ZV (buf)))
1497 && CHARPOS (top) >= BUF_BEGV (buf)
1498 && CHARPOS (top) <= BUF_ZV (buf)
1499 && pos_visible_p (w, posint, &x, &y, &rtop, &rbot, &rowh, &vpos)
1500 && (fully_p = !rtop && !rbot, (!NILP (partially) || fully_p)))
1501 in_window = Qt;
1502
1503 if (!NILP (in_window) && !NILP (partially))
1504 {
1505 Lisp_Object part = Qnil;
1506 if (!fully_p)
1507 part = list4 (make_number (rtop), make_number (rbot),
1508 make_number (rowh), make_number (vpos));
1509 in_window = Fcons (make_number (x),
1510 Fcons (make_number (y), part));
1511 }
1512
1513 return in_window;
1514}
1515
1516DEFUN ("window-line-height", Fwindow_line_height,
1517 Swindow_line_height, 0, 2, 0,
1518 doc: /* Return height in pixels of text line LINE in window WINDOW.
1519WINDOW defaults to the selected window.
1520
1521Return height of current line if LINE is omitted or nil. Return height of
1522header or mode line if LINE is `header-line' or `mode-line'.
1523Otherwise, LINE is a text line number starting from 0. A negative number
1524counts from the end of the window.
1525
1526Value is a list (HEIGHT VPOS YPOS OFFBOT), where HEIGHT is the height
1527in pixels of the visible part of the line, VPOS and YPOS are the
1528vertical position in lines and pixels of the line, relative to the top
1529of the first text line, and OFFBOT is the number of off-window pixels at
1530the bottom of the text line. If there are off-window pixels at the top
1531of the (first) text line, YPOS is negative.
1532
1533Return nil if window display is not up-to-date. In that case, use
1534`pos-visible-in-window-p' to obtain the information. */)
1535 (Lisp_Object line, Lisp_Object window)
1536{
1537 register struct window *w;
1538 register struct buffer *b;
1539 struct glyph_row *row, *end_row;
1540 int max_y, crop, i, n;
1541
1542 w = decode_window (window);
1543
1544 if (noninteractive || w->pseudo_window_p)
1545 return Qnil;
1546
1547 CHECK_BUFFER (w->buffer);
1548 b = XBUFFER (w->buffer);
1549
1550 /* Fail if current matrix is not up-to-date. */
1551 if (NILP (w->window_end_valid)
1552 || current_buffer->clip_changed
1553 || current_buffer->prevent_redisplay_optimizations_p
1554 || XFASTINT (w->last_modified) < BUF_MODIFF (b)
1555 || XFASTINT (w->last_overlay_modified) < BUF_OVERLAY_MODIFF (b))
1556 return Qnil;
1557
1558 if (NILP (line))
1559 {
1560 i = w->cursor.vpos;
1561 if (i < 0 || i >= w->current_matrix->nrows
1562 || (row = MATRIX_ROW (w->current_matrix, i), !row->enabled_p))
1563 return Qnil;
1564 max_y = window_text_bottom_y (w);
1565 goto found_row;
1566 }
1567
1568 if (EQ (line, Qheader_line))
1569 {
1570 if (!WINDOW_WANTS_HEADER_LINE_P (w))
1571 return Qnil;
1572 row = MATRIX_HEADER_LINE_ROW (w->current_matrix);
1573 if (!row->enabled_p)
1574 return Qnil;
1575 return list4 (make_number (row->height),
1576 make_number (0), make_number (0),
1577 make_number (0));
1578 }
1579
1580 if (EQ (line, Qmode_line))
1581 {
1582 row = MATRIX_MODE_LINE_ROW (w->current_matrix);
1583 if (!row->enabled_p)
1584 return Qnil;
1585 return list4 (make_number (row->height),
1586 make_number (0), /* not accurate */
1587 make_number (WINDOW_HEADER_LINE_HEIGHT (w)
1588 + window_text_bottom_y (w)),
1589 make_number (0));
1590 }
1591
1592 CHECK_NUMBER (line);
1593 n = XINT (line);
1594
1595 row = MATRIX_FIRST_TEXT_ROW (w->current_matrix);
1596 end_row = MATRIX_BOTTOM_TEXT_ROW (w->current_matrix, w);
1597 max_y = window_text_bottom_y (w);
1598 i = 0;
1599
1600 while ((n < 0 || i < n)
1601 && row <= end_row && row->enabled_p
1602 && row->y + row->height < max_y)
1603 row++, i++;
1604
1605 if (row > end_row || !row->enabled_p)
1606 return Qnil;
1607
1608 if (++n < 0)
1609 {
1610 if (-n > i)
1611 return Qnil;
1612 row += n;
1613 i += n;
1614 }
1615
1616 found_row:
1617 crop = max (0, (row->y + row->height) - max_y);
1618 return list4 (make_number (row->height + min (0, row->y) - crop),
1619 make_number (i),
1620 make_number (row->y),
1621 make_number (crop));
1622}
1489 1623
1490DEFUN ("window-dedicated-p", Fwindow_dedicated_p, Swindow_dedicated_p, 1624DEFUN ("window-dedicated-p", Fwindow_dedicated_p, Swindow_dedicated_p,
1491 0, 1, 0, 1625 0, 1, 0,
@@ -1513,22 +1647,22 @@ is the value returned by `window-dedicated-p' is t. */)
1513DEFUN ("set-window-dedicated-p", Fset_window_dedicated_p, 1647DEFUN ("set-window-dedicated-p", Fset_window_dedicated_p,
1514 Sset_window_dedicated_p, 2, 2, 0, 1648 Sset_window_dedicated_p, 2, 2, 0,
1515 doc: /* Mark WINDOW as dedicated according to FLAG. 1649 doc: /* Mark WINDOW as dedicated according to FLAG.
1516WINDOW defaults to the selected window. FLAG non-nil means mark WINDOW 1650WINDOW must be a live window and defaults to the selected one. FLAG
1517as dedicated to its buffer. FLAG nil means mark WINDOW as non-dedicated. 1651non-nil means mark WINDOW as dedicated to its buffer. FLAG nil means
1518Return FLAG. 1652mark WINDOW as non-dedicated. Return FLAG.
1519 1653
1520When a window is dedicated to its buffer, `display-buffer' will refrain 1654When a window is dedicated to its buffer, `display-buffer' will refrain
1521from displaying another buffer in it. `get-lru-window' and 1655from displaying another buffer in it. `get-lru-window' and
1522`get-largest-window' treat dedicated windows specially. 1656`get-largest-window' treat dedicated windows specially.
1523`delete-windows-on', `replace-buffer-in-windows', `quit-window' and 1657`delete-windows-on', `replace-buffer-in-windows', `quit-window',
1524`kill-buffer' can delete a dedicated window and the containing 1658`quit-restore-window' and `kill-buffer' can delete a dedicated window
1525frame. 1659and the containing frame.
1526 1660
1527As a special case, if FLAG is t, mark WINDOW as "strongly" dedicated to 1661As a special case, if FLAG is t, mark WINDOW as "strongly" dedicated to
1528its buffer. Functions like `set-window-buffer' may change the buffer 1662its buffer. Functions like `set-window-buffer' may change the buffer
1529displayed by a window, unless that window is strongly dedicated to its 1663displayed by a window, unless that window is strongly dedicated to its
1530buffer. If and when `set-window-buffer' displays another buffer in a 1664buffer. If and when `set-window-buffer' displays another buffer in a
1531window, it also makes sure that the window is not marked as dedicated. */) 1665window, it also makes sure that the window is no more dedicated. */)
1532 (Lisp_Object window, Lisp_Object flag) 1666 (Lisp_Object window, Lisp_Object flag)
1533{ 1667{
1534 register struct window *w = decode_window (window); 1668 register struct window *w = decode_window (window);
@@ -1537,6 +1671,52 @@ window, it also makes sure that the window is not marked as dedicated. */)
1537 return w->dedicated; 1671 return w->dedicated;
1538} 1672}
1539 1673
1674DEFUN ("window-prev-buffers", Fwindow_prev_buffers, Swindow_prev_buffers,
1675 0, 1, 0,
1676 doc: /* Return buffers previously shown in WINDOW.
1677WINDOW must be a live window and defaults to the selected one.
1678
1679The return value is either nil or a list of <buffer, window-start,
1680window-point> triples where buffer was previously shown in WINDOW. */)
1681 (Lisp_Object window)
1682{
1683 return decode_window (window)->prev_buffers;
1684}
1685
1686DEFUN ("set-window-prev-buffers", Fset_window_prev_buffers,
1687 Sset_window_prev_buffers, 2, 2, 0,
1688 doc: /* Set WINDOW's previous buffers to PREV-BUFFERS.
1689WINDOW must be a live window and defaults to the selected one. Return
1690PREV-BUFFERS.
1691
1692PREV-BUFFERS should be either nil or a list of <buffer, window-start,
1693window-point> triples where buffer was previously shown in WINDOW. */)
1694 (Lisp_Object window, Lisp_Object prev_buffers)
1695{
1696 return decode_any_window (window)->prev_buffers = prev_buffers;
1697}
1698
1699DEFUN ("window-next-buffers", Fwindow_next_buffers, Swindow_next_buffers,
1700 0, 1, 0,
1701 doc: /* Return list of buffers recently re-shown in WINDOW.
1702WINDOW must be a live window and defaults to the selected one. */)
1703 (Lisp_Object window)
1704{
1705 return decode_window (window)->next_buffers;
1706}
1707
1708DEFUN ("set-window-next-buffers", Fset_window_next_buffers,
1709 Sset_window_next_buffers, 2, 2, 0,
1710 doc: /* Set WINDOW's next buffers to NEXT-BUFFERS.
1711WINDOW must be a live window and defaults to the selected one. Return
1712NEXT-BUFFERS.
1713
1714NEXT-BUFFERS should be either nil or a list of buffers that have been
1715recently re-shown in WINDOW. */)
1716 (Lisp_Object window, Lisp_Object next_buffers)
1717{
1718 return decode_any_window (window)->next_buffers = next_buffers;
1719}
1540 1720
1541DEFUN ("window-parameters", Fwindow_parameters, Swindow_parameters, 1721DEFUN ("window-parameters", Fwindow_parameters, Swindow_parameters,
1542 0, 1, 0, 1722 0, 1, 0,
@@ -1545,7 +1725,7 @@ WINDOW defaults to the selected window. The return value is a list of
1545elements of the form (PARAMETER . VALUE). */) 1725elements of the form (PARAMETER . VALUE). */)
1546 (Lisp_Object window) 1726 (Lisp_Object window)
1547{ 1727{
1548 return Fcopy_alist (decode_window (window)->window_parameters); 1728 return Fcopy_alist (decode_any_window (window)->window_parameters);
1549} 1729}
1550 1730
1551DEFUN ("window-parameter", Fwindow_parameter, Swindow_parameter, 1731DEFUN ("window-parameter", Fwindow_parameter, Swindow_parameter,
@@ -1556,7 +1736,7 @@ WINDOW defaults to the selected window. */)
1556{ 1736{
1557 Lisp_Object result; 1737 Lisp_Object result;
1558 1738
1559 result = Fassq (parameter, decode_window (window)->window_parameters); 1739 result = Fassq (parameter, decode_any_window (window)->window_parameters);
1560 return CDR_SAFE (result); 1740 return CDR_SAFE (result);
1561} 1741}
1562 1742
@@ -1566,7 +1746,7 @@ DEFUN ("set-window-parameter", Fset_window_parameter,
1566WINDOW defaults to the selected window. Return VALUE. */) 1746WINDOW defaults to the selected window. Return VALUE. */)
1567 (Lisp_Object window, Lisp_Object parameter, Lisp_Object value) 1747 (Lisp_Object window, Lisp_Object parameter, Lisp_Object value)
1568{ 1748{
1569 register struct window *w = decode_window (window); 1749 register struct window *w = decode_any_window (window);
1570 Lisp_Object old_alist_elt; 1750 Lisp_Object old_alist_elt;
1571 1751
1572 old_alist_elt = Fassq (parameter, w->window_parameters); 1752 old_alist_elt = Fassq (parameter, w->window_parameters);
@@ -1577,7 +1757,6 @@ WINDOW defaults to the selected window. Return VALUE. */)
1577 return value; 1757 return value;
1578} 1758}
1579 1759
1580
1581DEFUN ("window-display-table", Fwindow_display_table, Swindow_display_table, 1760DEFUN ("window-display-table", Fwindow_display_table, Swindow_display_table,
1582 0, 1, 0, 1761 0, 1, 0,
1583 doc: /* Return the display-table that WINDOW is using. 1762 doc: /* Return the display-table that WINDOW is using.
@@ -1895,9 +2074,9 @@ delete_window (register Lisp_Object window)
1895 /* Since we may be deleting combination windows, we must make sure that 2074 /* Since we may be deleting combination windows, we must make sure that
1896 not only p but all its children have been marked as deleted. */ 2075 not only p but all its children have been marked as deleted. */
1897 if (! NILP (p->hchild)) 2076 if (! NILP (p->hchild))
1898 delete_all_subwindows (XWINDOW (p->hchild)); 2077 delete_all_subwindows (p->hchild);
1899 else if (! NILP (p->vchild)) 2078 else if (! NILP (p->vchild))
1900 delete_all_subwindows (XWINDOW (p->vchild)); 2079 delete_all_subwindows (p->vchild);
1901 2080
1902 /* Mark this window as deleted. */ 2081 /* Mark this window as deleted. */
1903 p->buffer = p->hchild = p->vchild = Qnil; 2082 p->buffer = p->hchild = p->vchild = Qnil;
@@ -1960,7 +2139,7 @@ delete_window (register Lisp_Object window)
1960 2139
1961/* Add window W to *USER_DATA. USER_DATA is actually a Lisp_Object 2140/* Add window W to *USER_DATA. USER_DATA is actually a Lisp_Object
1962 pointer. This is a callback function for foreach_window, used in 2141 pointer. This is a callback function for foreach_window, used in
1963 function window_list. */ 2142 the window_list function. */
1964 2143
1965static int 2144static int
1966add_window_to_list (struct window *w, void *user_data) 2145add_window_to_list (struct window *w, void *user_data)
@@ -2248,6 +2427,43 @@ reverse order. */)
2248} 2427}
2249 2428
2250 2429
2430DEFUN ("window-list-1", Fwindow_list_1, Swindow_list_1, 0, 3, 0,
2431 doc: /* Return a list of all live windows.
2432WINDOW specifies the first window to list and defaults to the selected
2433window.
2434
2435Optional argument MINIBUF nil or omitted means consider the minibuffer
2436window only if the minibuffer is active. MINIBUF t means consider the
2437minibuffer window even if the minibuffer is not active. Any other value
2438means do not consider the minibuffer window even if the minibuffer is
2439active.
2440
2441Optional argument ALL-FRAMES nil or omitted means consider all windows
2442on WINDOW's frame, plus the minibuffer window if specified by the
2443MINIBUF argument. If the minibuffer counts, consider all windows on all
2444frames that share that minibuffer too. The following non-nil values of
2445ALL-FRAMES have special meanings:
2446
2447- t means consider all windows on all existing frames.
2448
2449- `visible' means consider all windows on all visible frames.
2450
2451- 0 (the number zero) means consider all windows on all visible and
2452 iconified frames.
2453
2454- A frame means consider all windows on that frame only.
2455
2456Anything else means consider all windows on WINDOW's frame and no
2457others.
2458
2459If WINDOW is not on the list of windows returned, some other window will
2460be listed first but no error is signalled. */)
2461 (Lisp_Object window, Lisp_Object minibuf, Lisp_Object all_frames)
2462{
2463 return window_list_1 (window, minibuf, all_frames);
2464}
2465
2466
2251DEFUN ("other-window", Fother_window, Sother_window, 1, 2, "p", 2467DEFUN ("other-window", Fother_window, Sother_window, 1, 2, "p",
2252 doc: /* Select another window in cyclic ordering of windows. 2468 doc: /* Select another window in cyclic ordering of windows.
2253COUNT specifies the number of windows to skip, starting with the 2469COUNT specifies the number of windows to skip, starting with the
@@ -2279,29 +2495,6 @@ nil. */)
2279} 2495}
2280 2496
2281 2497
2282DEFUN ("window-list", Fwindow_list, Swindow_list, 0, 3, 0,
2283 doc: /* Return a list of windows on FRAME, starting with WINDOW.
2284FRAME nil or omitted means use the selected frame.
2285WINDOW nil or omitted means use the selected window.
2286MINIBUF t means include the minibuffer window, even if it isn't active.
2287MINIBUF nil or omitted means include the minibuffer window only
2288if it's active.
2289MINIBUF neither nil nor t means never include the minibuffer window. */)
2290 (Lisp_Object frame, Lisp_Object minibuf, Lisp_Object window)
2291{
2292 if (NILP (window))
2293 window = FRAMEP (frame) ? XFRAME (frame)->selected_window : selected_window;
2294 CHECK_WINDOW (window);
2295 if (NILP (frame))
2296 frame = selected_frame;
2297
2298 if (!EQ (frame, XWINDOW (window)->frame))
2299 error ("Window is on a different frame");
2300
2301 return window_list_1 (window, minibuf, frame);
2302}
2303
2304
2305/* Return a list of windows in cyclic ordering. Arguments are like 2498/* Return a list of windows in cyclic ordering. Arguments are like
2306 for `next-window'. */ 2499 for `next-window'. */
2307 2500
@@ -2331,6 +2524,29 @@ window_list_1 (Lisp_Object window, Lisp_Object minibuf, Lisp_Object all_frames)
2331} 2524}
2332 2525
2333 2526
2527DEFUN ("window-list", Fwindow_list, Swindow_list, 0, 3, 0,
2528 doc: /* Return a list of windows on FRAME, starting with WINDOW.
2529FRAME nil or omitted means use the selected frame.
2530WINDOW nil or omitted means use the selected window.
2531MINIBUF t means include the minibuffer window, even if it isn't active.
2532MINIBUF nil or omitted means include the minibuffer window only
2533if it's active.
2534MINIBUF neither nil nor t means never include the minibuffer window. */)
2535 (Lisp_Object frame, Lisp_Object minibuf, Lisp_Object window)
2536{
2537 if (NILP (window))
2538 window = FRAMEP (frame) ? XFRAME (frame)->selected_window : selected_window;
2539 CHECK_WINDOW (window);
2540 if (NILP (frame))
2541 frame = selected_frame;
2542
2543 if (!EQ (frame, XWINDOW (window)->frame))
2544 error ("Window is on a different frame");
2545
2546 return window_list_1 (window, minibuf, frame);
2547}
2548
2549
2334 2550
2335/* Look at all windows, performing an operation specified by TYPE 2551/* Look at all windows, performing an operation specified by TYPE
2336 with argument OBJ. 2552 with argument OBJ.
@@ -2344,10 +2560,8 @@ enum window_loop
2344{ 2560{
2345 WINDOW_LOOP_UNUSED, 2561 WINDOW_LOOP_UNUSED,
2346 GET_BUFFER_WINDOW, /* Arg is buffer */ 2562 GET_BUFFER_WINDOW, /* Arg is buffer */
2347 GET_LRU_WINDOW, /* Arg is t for full-width windows only */
2348 DELETE_OTHER_WINDOWS, /* Arg is window not to delete */ 2563 DELETE_OTHER_WINDOWS, /* Arg is window not to delete */
2349 DELETE_BUFFER_WINDOWS, /* Arg is buffer */ 2564 DELETE_BUFFER_WINDOWS, /* Arg is buffer */
2350 GET_LARGEST_WINDOW,
2351 UNSHOW_BUFFER, /* Arg is buffer */ 2565 UNSHOW_BUFFER, /* Arg is buffer */
2352 REDISPLAY_BUFFER_WINDOWS, /* Arg is buffer */ 2566 REDISPLAY_BUFFER_WINDOWS, /* Arg is buffer */
2353 CHECK_ALL_WINDOWS 2567 CHECK_ALL_WINDOWS
@@ -2430,21 +2644,6 @@ window_loop (enum window_loop type, Lisp_Object obj, int mini, Lisp_Object frame
2430 } 2644 }
2431 break; 2645 break;
2432 2646
2433 case GET_LRU_WINDOW:
2434 /* `obj' is an integer encoding a bitvector.
2435 `obj & 1' means consider only full-width windows.
2436 `obj & 2' means consider also dedicated windows. */
2437 if (((XINT (obj) & 1) && !WINDOW_FULL_WIDTH_P (w))
2438 || (!(XINT (obj) & 2) && !NILP (w->dedicated))
2439 /* Minibuffer windows are always ignored. */
2440 || MINI_WINDOW_P (w))
2441 break;
2442 if (NILP (best_window)
2443 || (XFASTINT (XWINDOW (best_window)->use_time)
2444 > XFASTINT (w->use_time)))
2445 best_window = window;
2446 break;
2447
2448 case DELETE_OTHER_WINDOWS: 2647 case DELETE_OTHER_WINDOWS:
2449 if (!EQ (window, obj)) 2648 if (!EQ (window, obj))
2450 Fdelete_window (window); 2649 Fdelete_window (window);
@@ -2489,24 +2688,6 @@ window_loop (enum window_loop type, Lisp_Object obj, int mini, Lisp_Object frame
2489 } 2688 }
2490 break; 2689 break;
2491 2690
2492 case GET_LARGEST_WINDOW:
2493 { /* nil `obj' means to ignore dedicated windows. */
2494 /* Ignore dedicated windows and minibuffers. */
2495 if (MINI_WINDOW_P (w) || (NILP (obj) && !NILP (w->dedicated)))
2496 break;
2497
2498 if (NILP (best_window))
2499 best_window = window;
2500 else
2501 {
2502 struct window *b = XWINDOW (best_window);
2503 if (XFASTINT (w->total_lines) * XFASTINT (w->total_cols)
2504 > XFASTINT (b->total_lines) * XFASTINT (b->total_cols))
2505 best_window = window;
2506 }
2507 }
2508 break;
2509
2510 case UNSHOW_BUFFER: 2691 case UNSHOW_BUFFER:
2511 if (EQ (w->buffer, obj)) 2692 if (EQ (w->buffer, obj))
2512 { 2693 {
@@ -2587,70 +2768,25 @@ check_all_windows (void)
2587 window_loop (CHECK_ALL_WINDOWS, Qnil, 1, Qt); 2768 window_loop (CHECK_ALL_WINDOWS, Qnil, 1, Qt);
2588} 2769}
2589 2770
2590DEFUN ("window-use-time", Fwindow_use_time, Swindow_use_time, 0, 1, 0, 2771DEFUN ("get-buffer-window", Fget_buffer_window, Sget_buffer_window, 0, 2, 0,
2591 doc: /* Return WINDOW's use time. 2772 doc: /* Return a window currently displaying BUFFER-OR-NAME, or nil if none.
2592WINDOW defaults to the selected window. The window with the highest use 2773BUFFER-OR-NAME may be a buffer or a buffer name and defaults to
2593time is the most recently selected one. The window with the lowest use 2774the current buffer.
2594time is the least recently selected one. */)
2595 (Lisp_Object window)
2596{
2597 return decode_window (window)->use_time;
2598}
2599 2775
2600DEFUN ("get-lru-window", Fget_lru_window, Sget_lru_window, 0, 2, 0, 2776The optional argument ALL-FRAMES specifies the frames to consider:
2601 doc: /* Return the window least recently selected or used for display.
2602\(LRU means Least Recently Used.)
2603 2777
2604Return a full-width window if possible. 2778- t means consider all windows on all existing frames.
2605A minibuffer window is never a candidate.
2606A dedicated window is never a candidate, unless DEDICATED is non-nil,
2607 so if all windows are dedicated, the value is nil.
2608If optional argument FRAME is `visible', search all visible frames.
2609If FRAME is 0, search all visible and iconified frames.
2610If FRAME is t, search all frames.
2611If FRAME is nil, search only the selected frame.
2612If FRAME is a frame, search only that frame. */)
2613 (Lisp_Object frame, Lisp_Object dedicated)
2614{
2615 register Lisp_Object w;
2616 /* First try for a window that is full-width */
2617 w = window_loop (GET_LRU_WINDOW,
2618 NILP (dedicated) ? make_number (1) : make_number (3),
2619 0, frame);
2620 if (!NILP (w) && !EQ (w, selected_window))
2621 return w;
2622 /* If none of them, try the rest */
2623 return window_loop (GET_LRU_WINDOW,
2624 NILP (dedicated) ? make_number (0) : make_number (2),
2625 0, frame);
2626}
2627
2628DEFUN ("get-largest-window", Fget_largest_window, Sget_largest_window, 0, 2, 0,
2629 doc: /* Return the largest window in area.
2630A minibuffer window is never a candidate.
2631A dedicated window is never a candidate unless DEDICATED is non-nil,
2632 so if all windows are dedicated, the value is nil.
2633If optional argument FRAME is `visible', search all visible frames.
2634If FRAME is 0, search all visible and iconified frames.
2635If FRAME is t, search all frames.
2636If FRAME is nil, search only the selected frame.
2637If FRAME is a frame, search only that frame. */)
2638 (Lisp_Object frame, Lisp_Object dedicated)
2639{
2640 return window_loop (GET_LARGEST_WINDOW, dedicated, 0,
2641 frame);
2642}
2643 2779
2644DEFUN ("get-buffer-window", Fget_buffer_window, Sget_buffer_window, 0, 2, 0, 2780- `visible' means consider all windows on all visible frames.
2645 doc: /* Return a window currently displaying BUFFER-OR-NAME, or nil if none. 2781
2646BUFFER-OR-NAME may be a buffer or a buffer name and defaults to the 2782- 0 (the number zero) means consider all windows on all visible
2647current buffer. 2783 and iconified frames.
2648If optional argument FRAME is `visible', search all visible frames. 2784
2649If optional argument FRAME is 0, search all visible and iconified frames. 2785- A frame means consider all windows on that frame only.
2650If FRAME is t, search all frames. 2786
2651If FRAME is nil, search only the selected frame. 2787Any other value of ALL-FRAMES means consider all windows on the
2652If FRAME is a frame, search only that frame. */) 2788selected frame and no others. */)
2653 (Lisp_Object buffer_or_name, Lisp_Object frame) 2789 (Lisp_Object buffer_or_name, Lisp_Object all_frames)
2654{ 2790{
2655 Lisp_Object buffer; 2791 Lisp_Object buffer;
2656 2792
@@ -2660,7 +2796,7 @@ If FRAME is a frame, search only that frame. */)
2660 buffer = Fget_buffer (buffer_or_name); 2796 buffer = Fget_buffer (buffer_or_name);
2661 2797
2662 if (BUFFERP (buffer)) 2798 if (BUFFERP (buffer))
2663 return window_loop (GET_BUFFER_WINDOW, buffer, 1, frame); 2799 return window_loop (GET_BUFFER_WINDOW, buffer, 1, all_frames);
2664 else 2800 else
2665 return Qnil; 2801 return Qnil;
2666} 2802}
@@ -2810,18 +2946,6 @@ replace_buffer_in_all_windows (Lisp_Object buffer)
2810 2946
2811/* Set the height of WINDOW and all its inferiors. */ 2947/* Set the height of WINDOW and all its inferiors. */
2812 2948
2813/* The smallest acceptable dimensions for a window. Anything smaller
2814 might crash Emacs. */
2815
2816#define MIN_SAFE_WINDOW_WIDTH (2)
2817#define MIN_SAFE_WINDOW_HEIGHT (1)
2818
2819/* For wp non-zero the total number of columns of window w. Otherwise
2820 the total number of lines of w. */
2821
2822#define WINDOW_TOTAL_SIZE(w, wp) \
2823 (wp ? WINDOW_TOTAL_COLS (w) : WINDOW_TOTAL_LINES (w))
2824
2825/* If *ROWS or *COLS are too small a size for FRAME, set them to the 2949/* If *ROWS or *COLS are too small a size for FRAME, set them to the
2826 minimum allowable size. */ 2950 minimum allowable size. */
2827 2951
@@ -3692,6 +3816,17 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int
3692 unbind_to (count, Qnil); 3816 unbind_to (count, Qnil);
3693} 3817}
3694 3818
3819DEFUN ("set-window-clone-number", Fset_window_clone_number, Sset_window_clone_number, 2, 2, 0,
3820 doc: /* Set WINDOW's clone number to CLONE-NUMBER.
3821WINDOW can be any window and defaults to the selected one. */)
3822 (Lisp_Object window, Lisp_Object clone_number)
3823{
3824 register struct window *w = decode_any_window (window);
3825
3826 CHECK_NUMBER (clone_number);
3827 w->clone_number = clone_number;
3828 return w->clone_number;
3829}
3695 3830
3696DEFUN ("set-window-buffer", Fset_window_buffer, Sset_window_buffer, 2, 3, 0, 3831DEFUN ("set-window-buffer", Fset_window_buffer, Sset_window_buffer, 2, 3, 0,
3697 doc: /* Make WINDOW display BUFFER-OR-NAME as its contents. 3832 doc: /* Make WINDOW display BUFFER-OR-NAME as its contents.
@@ -3881,6 +4016,7 @@ make_dummy_parent (Lisp_Object window)
3881 4016
3882 ++sequence_number; 4017 ++sequence_number;
3883 XSETFASTINT (p->sequence_number, sequence_number); 4018 XSETFASTINT (p->sequence_number, sequence_number);
4019 XSETFASTINT (p->clone_number, sequence_number);
3884 4020
3885 /* Put new into window structure in place of window */ 4021 /* Put new into window structure in place of window */
3886 replace_window (window, new); 4022 replace_window (window, new);
@@ -3894,6 +4030,112 @@ make_dummy_parent (Lisp_Object window)
3894 p->start = Qnil; 4030 p->start = Qnil;
3895 p->pointm = Qnil; 4031 p->pointm = Qnil;
3896 p->buffer = Qnil; 4032 p->buffer = Qnil;
4033
4034 p->splits = Qnil;
4035 p->nest = Qnil;
4036 p->window_parameters = Qnil;
4037
4038}
4039
4040/* Make new window from scratch. */
4041Lisp_Object
4042make_window (void)
4043{
4044 Lisp_Object window;
4045 register struct window *w;
4046
4047 w = allocate_window ();
4048 /* Initialize all Lisp data. */
4049 w->frame = w->mini_p = Qnil;
4050 w->next = w->prev = w->hchild = w->vchild = w->parent = Qnil;
4051 XSETFASTINT (w->left_col, 0);
4052 XSETFASTINT (w->top_line, 0);
4053 XSETFASTINT (w->total_lines, 0);
4054 XSETFASTINT (w->total_cols, 0);
4055 w->normal_lines = make_float (1.0);
4056 w->normal_cols = make_float (1.0);
4057 XSETFASTINT (w->new_total, 0);
4058 XSETFASTINT (w->new_normal, 0);
4059 w->buffer = Qnil;
4060 w->start = Fmake_marker ();
4061 w->pointm = Fmake_marker ();
4062 w->force_start = w->optional_new_start = Qnil;
4063 XSETFASTINT (w->hscroll, 0);
4064 XSETFASTINT (w->min_hscroll, 0);
4065 XSETFASTINT (w->use_time, 0);
4066 ++sequence_number;
4067 XSETFASTINT (w->sequence_number, sequence_number);
4068 XSETFASTINT (w->clone_number, sequence_number);
4069 w->temslot = w->last_modified = w->last_overlay_modified = Qnil;
4070 XSETFASTINT (w->last_point, 0);
4071 w->last_had_star = w->vertical_scroll_bar = Qnil;
4072 w->left_margin_cols = w->right_margin_cols = Qnil;
4073 w->left_fringe_width = w->right_fringe_width = Qnil;
4074 w->fringes_outside_margins = Qnil;
4075 w->scroll_bar_width = Qnil;
4076 w->vertical_scroll_bar_type = Qt;
4077 w->last_mark_x = w->last_mark_y = Qnil;
4078 XSETFASTINT (w->window_end_pos, 0);
4079 XSETFASTINT (w->window_end_vpos, 0);
4080 w->window_end_valid = w->update_mode_line = Qnil;
4081 w->start_at_line_beg = w->display_table = w->dedicated = Qnil;
4082 w->base_line_number = w->base_line_pos = w->region_showing = Qnil;
4083 w->column_number_displayed = w->redisplay_end_trigger = Qnil;
4084 w->splits = w->nest = w->window_parameters = Qnil;
4085 w->prev_buffers = w->next_buffers = Qnil;
4086 /* Initialize non-Lisp data. */
4087 w->desired_matrix = w->current_matrix = 0;
4088 w->nrows_scale_factor = w->ncols_scale_factor = 1;
4089 memset (&w->cursor, 0, sizeof (w->cursor));
4090 memset (&w->last_cursor, 0, sizeof (w->last_cursor));
4091 memset (&w->phys_cursor, 0, sizeof (w->phys_cursor));
4092 w->phys_cursor_type = -1;
4093 w->phys_cursor_width = -1;
4094 w->last_cursor_off_p = w->cursor_off_p = 0;
4095 w->must_be_updated_p = 0;
4096 w->pseudo_window_p = 0;
4097 w->frozen_window_start_p = 0;
4098 w->vscroll = 0;
4099 w->resize_proportionally = Qnil;
4100 /* Reset window_list. */
4101 Vwindow_list = Qnil;
4102 /* Return window. */
4103 XSETWINDOW (window, w);
4104 return window;
4105}
4106
4107DEFUN ("set-window-new-total", Fset_window_new_total, Sset_window_new_total, 2, 3, 0,
4108 doc: /* Set new total size of WINDOW to SIZE.
4109Return SIZE.
4110
4111Optional argument ADD non-nil means add SIZE to the new total size of
4112WINDOW and return the sum.
4113
4114Note: This function does not operate on any subwindows of WINDOW. */)
4115 (Lisp_Object window, Lisp_Object size, Lisp_Object add)
4116{
4117 struct window *w = decode_any_window (window);
4118
4119 CHECK_NUMBER (size);
4120 if (NILP (add))
4121 XSETINT (w->new_total, XINT (size));
4122 else
4123 XSETINT (w->new_total, XINT (w->new_total) + XINT (size));
4124
4125 return w->new_total;
4126}
4127
4128DEFUN ("set-window-new-normal", Fset_window_new_normal, Sset_window_new_normal, 1, 2, 0,
4129 doc: /* Set new normal size of WINDOW to SIZE.
4130Return SIZE.
4131
4132Note: This function does not operate on any subwindows of WINDOW. */)
4133 (Lisp_Object window, Lisp_Object size)
4134{
4135 struct window *w = decode_any_window (window);
4136
4137 w->new_normal = size;
4138 return w->new_normal;
3897} 4139}
3898 4140
3899DEFUN ("split-window", Fsplit_window, Ssplit_window, 0, 3, "", 4141DEFUN ("split-window", Fsplit_window, Ssplit_window, 0, 3, "",
@@ -4808,37 +5050,6 @@ window_internal_height (struct window *w)
4808 5050
4809 return ht; 5051 return ht;
4810} 5052}
4811
4812
4813/* Return the number of columns in W.
4814 Don't count columns occupied by scroll bars or the vertical bar
4815 separating W from the sibling to its right. */
4816
4817int
4818window_box_text_cols (struct window *w)
4819{
4820 struct frame *f = XFRAME (WINDOW_FRAME (w));
4821 int width = XINT (w->total_cols);
4822
4823 if (WINDOW_HAS_VERTICAL_SCROLL_BAR (w))
4824 /* Scroll bars occupy a few columns. */
4825 width -= WINDOW_CONFIG_SCROLL_BAR_COLS (w);
4826 else if (!FRAME_WINDOW_P (f)
4827 && !WINDOW_RIGHTMOST_P (w) && !WINDOW_FULL_WIDTH_P (w))
4828 /* The column of `|' characters separating side-by-side windows
4829 occupies one column only. */
4830 width -= 1;
4831
4832 if (FRAME_WINDOW_P (f))
4833 /* On window-systems, fringes and display margins cannot be
4834 used for normal text. */
4835 width -= (WINDOW_FRINGE_COLS (w)
4836 + WINDOW_LEFT_MARGIN_COLS (w)
4837 + WINDOW_RIGHT_MARGIN_COLS (w));
4838
4839 return width;
4840}
4841
4842 5053
4843/************************************************************************ 5054/************************************************************************
4844 Window Scrolling 5055 Window Scrolling
@@ -5547,7 +5758,7 @@ by this function. This happens in an interactive call. */)
5547 struct window *w = XWINDOW (selected_window); 5758 struct window *w = XWINDOW (selected_window);
5548 5759
5549 if (NILP (arg)) 5760 if (NILP (arg))
5550 XSETFASTINT (arg, window_box_text_cols (w) - 2); 5761 XSETFASTINT (arg, window_body_cols (w) - 2);
5551 else 5762 else
5552 arg = Fprefix_numeric_value (arg); 5763 arg = Fprefix_numeric_value (arg);
5553 5764
@@ -5576,7 +5787,7 @@ by this function. This happens in an interactive call. */)
5576 struct window *w = XWINDOW (selected_window); 5787 struct window *w = XWINDOW (selected_window);
5577 5788
5578 if (NILP (arg)) 5789 if (NILP (arg))
5579 XSETFASTINT (arg, window_box_text_cols (w) - 2); 5790 XSETFASTINT (arg, window_body_cols (w) - 2);
5580 else 5791 else
5581 arg = Fprefix_numeric_value (arg); 5792 arg = Fprefix_numeric_value (arg);
5582 5793
@@ -5970,9 +6181,11 @@ struct save_window_data
5970struct saved_window 6181struct saved_window
5971{ 6182{
5972 struct vectorlike_header header; 6183 struct vectorlike_header header;
5973 Lisp_Object window; 6184
6185 Lisp_Object window, clone_number;
5974 Lisp_Object buffer, start, pointm, mark; 6186 Lisp_Object buffer, start, pointm, mark;
5975 Lisp_Object left_col, top_line, total_cols, total_lines; 6187 Lisp_Object left_col, top_line, total_cols, total_lines;
6188 Lisp_Object normal_cols, normal_lines;
5976 Lisp_Object hscroll, min_hscroll; 6189 Lisp_Object hscroll, min_hscroll;
5977 Lisp_Object parent, prev; 6190 Lisp_Object parent, prev;
5978 Lisp_Object start_at_line_beg; 6191 Lisp_Object start_at_line_beg;
@@ -5982,6 +6195,7 @@ struct saved_window
5982 Lisp_Object left_fringe_width, right_fringe_width, fringes_outside_margins; 6195 Lisp_Object left_fringe_width, right_fringe_width, fringes_outside_margins;
5983 Lisp_Object scroll_bar_width, vertical_scroll_bar_type; 6196 Lisp_Object scroll_bar_width, vertical_scroll_bar_type;
5984 Lisp_Object dedicated, resize_proportionally; 6197 Lisp_Object dedicated, resize_proportionally;
6198 Lisp_Object splits, nest, window_parameters;
5985}; 6199};
5986 6200
5987#define SAVED_WINDOW_N(swv,n) \ 6201#define SAVED_WINDOW_N(swv,n) \
@@ -6148,7 +6362,7 @@ the return value is nil. Otherwise the value is t. */)
6148 Save their current buffers in their height fields, since we may 6362 Save their current buffers in their height fields, since we may
6149 need it later, if a buffer saved in the configuration is now 6363 need it later, if a buffer saved in the configuration is now
6150 dead. */ 6364 dead. */
6151 delete_all_subwindows (XWINDOW (FRAME_ROOT_WINDOW (f))); 6365 delete_all_subwindows (FRAME_ROOT_WINDOW (f));
6152 6366
6153 for (k = 0; k < saved_windows->header.size; k++) 6367 for (k = 0; k < saved_windows->header.size; k++)
6154 { 6368 {
@@ -6186,6 +6400,7 @@ the return value is nil. Otherwise the value is t. */)
6186 } 6400 }
6187 } 6401 }
6188 6402
6403 w->clone_number = p->clone_number;
6189 /* If we squirreled away the buffer in the window's height, 6404 /* If we squirreled away the buffer in the window's height,
6190 restore it now. */ 6405 restore it now. */
6191 if (BUFFERP (w->total_lines)) 6406 if (BUFFERP (w->total_lines))
@@ -6194,6 +6409,8 @@ the return value is nil. Otherwise the value is t. */)
6194 w->top_line = p->top_line; 6409 w->top_line = p->top_line;
6195 w->total_cols = p->total_cols; 6410 w->total_cols = p->total_cols;
6196 w->total_lines = p->total_lines; 6411 w->total_lines = p->total_lines;
6412 w->normal_cols = p->normal_cols;
6413 w->normal_lines = p->normal_lines;
6197 w->hscroll = p->hscroll; 6414 w->hscroll = p->hscroll;
6198 w->min_hscroll = p->min_hscroll; 6415 w->min_hscroll = p->min_hscroll;
6199 w->display_table = p->display_table; 6416 w->display_table = p->display_table;
@@ -6207,6 +6424,9 @@ the return value is nil. Otherwise the value is t. */)
6207 w->scroll_bar_width = p->scroll_bar_width; 6424 w->scroll_bar_width = p->scroll_bar_width;
6208 w->vertical_scroll_bar_type = p->vertical_scroll_bar_type; 6425 w->vertical_scroll_bar_type = p->vertical_scroll_bar_type;
6209 w->dedicated = p->dedicated; 6426 w->dedicated = p->dedicated;
6427 w->splits = p->splits;
6428 w->nest = p->nest;
6429 w->window_parameters = p->window_parameters;
6210 w->resize_proportionally = p->resize_proportionally; 6430 w->resize_proportionally = p->resize_proportionally;
6211 XSETFASTINT (w->last_modified, 0); 6431 XSETFASTINT (w->last_modified, 0);
6212 XSETFASTINT (w->last_overlay_modified, 0); 6432 XSETFASTINT (w->last_overlay_modified, 0);
@@ -6336,31 +6556,38 @@ the return value is nil. Otherwise the value is t. */)
6336 return (FRAME_LIVE_P (f) ? Qt : Qnil); 6556 return (FRAME_LIVE_P (f) ? Qt : Qnil);
6337} 6557}
6338 6558
6339/* Mark all windows now on frame as deleted 6559/* Delete all subwindows reachable via the next, vchild, and hchild
6340 by setting their buffers to nil. */ 6560 slots of WINDOW. */
6341
6342void 6561void
6343delete_all_subwindows (register struct window *w) 6562delete_all_subwindows (Lisp_Object window)
6344{ 6563{
6564 register struct window *w;
6565
6566 w = XWINDOW (window);
6567
6345 if (!NILP (w->next)) 6568 if (!NILP (w->next))
6346 delete_all_subwindows (XWINDOW (w->next)); 6569 /* Delete WINDOW's siblings (we traverse postorderly). */
6347 if (!NILP (w->vchild)) 6570 delete_all_subwindows (w->next);
6348 delete_all_subwindows (XWINDOW (w->vchild));
6349 if (!NILP (w->hchild))
6350 delete_all_subwindows (XWINDOW (w->hchild));
6351 6571
6352 w->total_lines = w->buffer; /* See Fset_window_configuration for excuse. */ 6572 w->total_lines = w->buffer; /* See Fset_window_configuration for excuse. */
6353 6573
6354 if (!NILP (w->buffer)) 6574 if (!NILP (w->vchild))
6355 unshow_buffer (w); 6575 {
6356 6576 delete_all_subwindows (w->vchild);
6357 /* We set all three of these fields to nil, to make sure that we can 6577 w->vchild = Qnil;
6358 distinguish this dead window from any live window. Live leaf 6578 }
6359 windows will have buffer set, and combination windows will have 6579 else if (!NILP (w->hchild))
6360 vchild or hchild set. */ 6580 {
6361 w->buffer = Qnil; 6581 delete_all_subwindows (w->hchild);
6362 w->vchild = Qnil; 6582 w->hchild = Qnil;
6363 w->hchild = Qnil; 6583 }
6584 else if (!NILP (w->buffer))
6585 {
6586 unshow_buffer (w);
6587 unchain_marker (XMARKER (w->pointm));
6588 unchain_marker (XMARKER (w->start));
6589 w->buffer = Qnil;
6590 }
6364 6591
6365 Vwindow_list = Qnil; 6592 Vwindow_list = Qnil;
6366} 6593}
@@ -6438,11 +6665,14 @@ save_window_save (Lisp_Object window, struct Lisp_Vector *vector, int i)
6438 6665
6439 XSETFASTINT (w->temslot, i); i++; 6666 XSETFASTINT (w->temslot, i); i++;
6440 p->window = window; 6667 p->window = window;
6668 p->clone_number = w->clone_number;
6441 p->buffer = w->buffer; 6669 p->buffer = w->buffer;
6442 p->left_col = w->left_col; 6670 p->left_col = w->left_col;
6443 p->top_line = w->top_line; 6671 p->top_line = w->top_line;
6444 p->total_cols = w->total_cols; 6672 p->total_cols = w->total_cols;
6445 p->total_lines = w->total_lines; 6673 p->total_lines = w->total_lines;
6674 p->normal_cols = w->normal_cols;
6675 p->normal_lines = w->normal_lines;
6446 p->hscroll = w->hscroll; 6676 p->hscroll = w->hscroll;
6447 p->min_hscroll = w->min_hscroll; 6677 p->min_hscroll = w->min_hscroll;
6448 p->display_table = w->display_table; 6678 p->display_table = w->display_table;
@@ -6456,7 +6686,10 @@ save_window_save (Lisp_Object window, struct Lisp_Vector *vector, int i)
6456 p->scroll_bar_width = w->scroll_bar_width; 6686 p->scroll_bar_width = w->scroll_bar_width;
6457 p->vertical_scroll_bar_type = w->vertical_scroll_bar_type; 6687 p->vertical_scroll_bar_type = w->vertical_scroll_bar_type;
6458 p->dedicated = w->dedicated; 6688 p->dedicated = w->dedicated;
6689 p->splits = w->splits;
6690 p->nest = w->nest;
6459 p->resize_proportionally = w->resize_proportionally; 6691 p->resize_proportionally = w->resize_proportionally;
6692 p->window_parameters = w->window_parameters;
6460 if (!NILP (w->buffer)) 6693 if (!NILP (w->buffer))
6461 { 6694 {
6462 /* Save w's value of point in the window configuration. 6695 /* Save w's value of point in the window configuration.
@@ -7166,12 +7399,45 @@ syms_of_window (void)
7166 Qwindow_live_p = intern_c_string ("window-live-p"); 7399 Qwindow_live_p = intern_c_string ("window-live-p");
7167 staticpro (&Qwindow_live_p); 7400 staticpro (&Qwindow_live_p);
7168 7401
7402 Qwindow_deletable_p = intern_c_string ("window-deletable-p");
7403 staticpro (&Qwindow_deletable_p);
7404
7405 Qdelete_window = intern_c_string ("delete-window");
7406 staticpro (&Qdelete_window);
7407
7408 Qresize_root_window = intern_c_string ("resize-root-window");
7409 staticpro (&Qresize_root_window);
7410
7411 Qresize_root_window_vertically = intern_c_string ("resize-root-window-vertically");
7412 staticpro (&Qresize_root_window_vertically);
7413
7414 Qsafe = intern_c_string ("safe");
7415 staticpro (&Qsafe);
7416
7169 Qdisplay_buffer = intern_c_string ("display-buffer"); 7417 Qdisplay_buffer = intern_c_string ("display-buffer");
7170 staticpro (&Qdisplay_buffer); 7418 staticpro (&Qdisplay_buffer);
7171 7419
7420 Qreplace_buffer_in_windows = intern_c_string ("replace-buffer-in-windows");
7421 staticpro (&Qreplace_buffer_in_windows);
7422
7423 Qrecord_window_buffer = intern_c_string ("record-window-buffer");
7424 staticpro (&Qrecord_window_buffer);
7425
7426 Qget_mru_window = intern_c_string ("get-mru-window");
7427 staticpro (&Qget_mru_window);
7428
7172 Qtemp_buffer_show_hook = intern_c_string ("temp-buffer-show-hook"); 7429 Qtemp_buffer_show_hook = intern_c_string ("temp-buffer-show-hook");
7173 staticpro (&Qtemp_buffer_show_hook); 7430 staticpro (&Qtemp_buffer_show_hook);
7174 7431
7432 Qabove = intern_c_string ("above");
7433 staticpro (&Qabove);
7434
7435 Qbelow = intern_c_string ("below");
7436 staticpro (&Qbelow);
7437
7438 Qauto_buffer_name = intern_c_string ("auto-buffer-name");
7439 staticpro (&Qauto_buffer_name);
7440
7175 staticpro (&Vwindow_list); 7441 staticpro (&Vwindow_list);
7176 7442
7177 minibuf_selected_window = Qnil; 7443 minibuf_selected_window = Qnil;
@@ -7274,15 +7540,27 @@ frame to be redrawn only if it is a tty frame. */);
7274 defsubr (&Sset_frame_selected_window); 7540 defsubr (&Sset_frame_selected_window);
7275 defsubr (&Spos_visible_in_window_p); 7541 defsubr (&Spos_visible_in_window_p);
7276 defsubr (&Swindow_line_height); 7542 defsubr (&Swindow_line_height);
7543 defsubr (&Swindow_clone_number);
7277 defsubr (&Swindow_buffer); 7544 defsubr (&Swindow_buffer);
7278 defsubr (&Swindow_parent); 7545 defsubr (&Swindow_parent);
7279 defsubr (&Swindow_vchild); 7546 defsubr (&Swindow_vchild);
7280 defsubr (&Swindow_hchild); 7547 defsubr (&Swindow_hchild);
7281 defsubr (&Swindow_next); 7548 defsubr (&Swindow_next);
7282 defsubr (&Swindow_prev); 7549 defsubr (&Swindow_prev);
7283 defsubr (&Swindow_height); 7550 defsubr (&Swindow_splits);
7284 defsubr (&Swindow_width); 7551 defsubr (&Sset_window_splits);
7285 defsubr (&Swindow_full_width_p); 7552 defsubr (&Swindow_nest);
7553 defsubr (&Sset_window_nest);
7554 defsubr (&Swindow_use_time);
7555 defsubr (&Swindow_top_line);
7556 defsubr (&Swindow_left_column);
7557 defsubr (&Swindow_total_size);
7558 defsubr (&Swindow_normal_size);
7559 defsubr (&Swindow_new_total);
7560 defsubr (&Swindow_new_normal);
7561 defsubr (&Sset_window_new_total);
7562 defsubr (&Sset_window_new_normal);
7563 defsubr (&Swindow_body_size);
7286 defsubr (&Swindow_hscroll); 7564 defsubr (&Swindow_hscroll);
7287 defsubr (&Sset_window_hscroll); 7565 defsubr (&Sset_window_hscroll);
7288 defsubr (&Swindow_redisplay_end_trigger); 7566 defsubr (&Swindow_redisplay_end_trigger);
@@ -7307,15 +7585,13 @@ frame to be redrawn only if it is a tty frame. */);
7307 defsubr (&Snext_window); 7585 defsubr (&Snext_window);
7308 defsubr (&Sprevious_window); 7586 defsubr (&Sprevious_window);
7309 defsubr (&Sother_window); 7587 defsubr (&Sother_window);
7310 defsubr (&Sget_lru_window);
7311 defsubr (&Swindow_use_time);
7312 defsubr (&Sget_largest_window);
7313 defsubr (&Sget_buffer_window); 7588 defsubr (&Sget_buffer_window);
7314 defsubr (&Sdelete_other_windows); 7589 defsubr (&Sdelete_other_windows);
7315 defsubr (&Sdelete_windows_on); 7590 defsubr (&Sdelete_windows_on);
7316 defsubr (&Sreplace_buffer_in_windows); 7591 defsubr (&Sreplace_buffer_in_windows);
7317 defsubr (&Sdelete_window); 7592 defsubr (&Sdelete_window);
7318 defsubr (&Sset_window_buffer); 7593 defsubr (&Sset_window_buffer);
7594 defsubr (&Sset_window_clone_number);
7319 defsubr (&Sselect_window); 7595 defsubr (&Sselect_window);
7320 defsubr (&Sforce_window_update); 7596 defsubr (&Sforce_window_update);
7321 defsubr (&Stemp_output_buffer_show); 7597 defsubr (&Stemp_output_buffer_show);
@@ -7348,10 +7624,14 @@ frame to be redrawn only if it is a tty frame. */);
7348 defsubr (&Sset_window_vscroll); 7624 defsubr (&Sset_window_vscroll);
7349 defsubr (&Scompare_window_configurations); 7625 defsubr (&Scompare_window_configurations);
7350 defsubr (&Swindow_list); 7626 defsubr (&Swindow_list);
7627 defsubr (&Swindow_list_1);
7628 defsubr (&Swindow_prev_buffers);
7629 defsubr (&Sset_window_prev_buffers);
7630 defsubr (&Swindow_next_buffers);
7631 defsubr (&Sset_window_next_buffers);
7351 defsubr (&Swindow_parameters); 7632 defsubr (&Swindow_parameters);
7352 defsubr (&Swindow_parameter); 7633 defsubr (&Swindow_parameter);
7353 defsubr (&Sset_window_parameter); 7634 defsubr (&Sset_window_parameter);
7354
7355} 7635}
7356 7636
7357void 7637void
diff --git a/src/window.h b/src/window.h
index 96e30d98d24..c33179de9ba 100644
--- a/src/window.h
+++ b/src/window.h
@@ -93,38 +93,57 @@ struct window
93 93
94 /* The frame this window is on. */ 94 /* The frame this window is on. */
95 Lisp_Object frame; 95 Lisp_Object frame;
96
96 /* t if this window is a minibuffer window. */ 97 /* t if this window is a minibuffer window. */
97 Lisp_Object mini_p; 98 Lisp_Object mini_p;
98 /* Following child (to right or down) at same level of tree */ 99
99 Lisp_Object next; 100 /* Following (to right or down) and preceding (to left or up) child
100 /* Preceding child (to left or up) at same level of tree */ 101 at same level of tree. */
101 Lisp_Object prev; 102 Lisp_Object next, prev;
102 /* First child of this window. */ 103
103 /* vchild is used if this is a vertical combination, 104 /* First child of this window: vchild is used if this is a vertical
104 hchild if this is a horizontal combination. */ 105 combination, hchild if this is a horizontal combination. Of the
106 fields vchild, hchild and buffer, one and only one is non-nil
107 unless the window is dead. */
105 Lisp_Object hchild, vchild; 108 Lisp_Object hchild, vchild;
106 /* The window this one is a child of. */ 109
110 /* The window this one is a child of. */
107 Lisp_Object parent; 111 Lisp_Object parent;
108 /* The upper left corner coordinates of this window, 112
109 as integers relative to upper left corner of frame = 0, 0 */ 113 /* The upper left corner coordinates of this window, as integers
114 relative to upper left corner of frame = 0, 0. */
110 Lisp_Object left_col; 115 Lisp_Object left_col;
111 Lisp_Object top_line; 116 Lisp_Object top_line;
112 /* The size of the window */ 117
118 /* The size of the window. */
113 Lisp_Object total_lines; 119 Lisp_Object total_lines;
114 Lisp_Object total_cols; 120 Lisp_Object total_cols;
115 /* The buffer displayed in this window */ 121
116 /* Of the fields vchild, hchild and buffer, only one is non-nil. */ 122 /* The normal size of the window. */
123 Lisp_Object normal_lines;
124 Lisp_Object normal_cols;
125
126 /* New sizes of the window. */
127 Lisp_Object new_total;
128 Lisp_Object new_normal;
129
130 /* The buffer displayed in this window. Of the fields vchild,
131 hchild and buffer, one and only one is non-nil unless the window
132 is dead. */
117 Lisp_Object buffer; 133 Lisp_Object buffer;
134
118 /* A marker pointing to where in the text to start displaying. 135 /* A marker pointing to where in the text to start displaying.
119 BIDI Note: This is the _logical-order_ start, i.e. the smallest 136 BIDI Note: This is the _logical-order_ start, i.e. the smallest
120 buffer position visible in the window, not necessarily the 137 buffer position visible in the window, not necessarily the
121 character displayed in the top left corner of the window. */ 138 character displayed in the top left corner of the window. */
122 Lisp_Object start; 139 Lisp_Object start;
140
123 /* A marker pointing to where in the text point is in this window, 141 /* A marker pointing to where in the text point is in this window,
124 used only when the window is not selected. 142 used only when the window is not selected.
125 This exists so that when multiple windows show one buffer 143 This exists so that when multiple windows show one buffer
126 each one can have its own value of point. */ 144 each one can have its own value of point. */
127 Lisp_Object pointm; 145 Lisp_Object pointm;
146
128 /* Non-nil means next redisplay must use the value of start 147 /* Non-nil means next redisplay must use the value of start
129 set up for it in advance. Set by scrolling commands. */ 148 set up for it in advance. Set by scrolling commands. */
130 Lisp_Object force_start; 149 Lisp_Object force_start;
@@ -133,26 +152,38 @@ struct window
133 This is used in Fdelete_other_windows to force a call to 152 This is used in Fdelete_other_windows to force a call to
134 Vwindow_scroll_functions; also by Frecenter with argument. */ 153 Vwindow_scroll_functions; also by Frecenter with argument. */
135 Lisp_Object optional_new_start; 154 Lisp_Object optional_new_start;
155
136 /* Number of columns display within the window is scrolled to the left. */ 156 /* Number of columns display within the window is scrolled to the left. */
137 Lisp_Object hscroll; 157 Lisp_Object hscroll;
138 /* Minimum hscroll for automatic hscrolling. This is the value 158 /* Minimum hscroll for automatic hscrolling. This is the value
139 the user has set, by set-window-hscroll for example. */ 159 the user has set, by set-window-hscroll for example. */
140 Lisp_Object min_hscroll; 160 Lisp_Object min_hscroll;
141 /* Number saying how recently window was selected */ 161
162 /* Number saying how recently window was selected. */
142 Lisp_Object use_time; 163 Lisp_Object use_time;
143 /* Unique number of window assigned when it was created */ 164
165 /* Unique number of window assigned when it was created. */
144 Lisp_Object sequence_number; 166 Lisp_Object sequence_number;
145 /* No permanent meaning; used by save-window-excursion's bookkeeping */ 167
168 /* Sequence number of window this window was cloned from. Identic
169 to sequence number if window was not cloned. */
170 Lisp_Object clone_number;
171
172 /* No permanent meaning; used by save-window-excursion's
173 bookkeeping. */
146 Lisp_Object temslot; 174 Lisp_Object temslot;
147 /* text.modified of displayed buffer as of last time display completed */ 175
176 /* text.modified of displayed buffer as of last time display
177 completed. */
148 Lisp_Object last_modified; 178 Lisp_Object last_modified;
149 /* BUF_OVERLAY_MODIFIED of displayed buffer as of last complete update. */ 179 /* BUF_OVERLAY_MODIFIED of displayed buffer as of last complete update. */
150 Lisp_Object last_overlay_modified; 180 Lisp_Object last_overlay_modified;
151 /* Value of point at that time */ 181 /* Value of point at that time. */
152 Lisp_Object last_point; 182 Lisp_Object last_point;
153 /* Non-nil if the buffer was "modified" when the window 183 /* Non-nil if the buffer was "modified" when the window
154 was last updated. */ 184 was last updated. */
155 Lisp_Object last_had_star; 185 Lisp_Object last_had_star;
186
156 /* This window's vertical scroll bar. This field is only for use 187 /* This window's vertical scroll bar. This field is only for use
157 by the window-system-dependent code which implements the 188 by the window-system-dependent code which implements the
158 scroll bars; it can store anything it likes here. If this 189 scroll bars; it can store anything it likes here. If this
@@ -167,14 +198,14 @@ struct window
167 /* Width of left and right fringes. 198 /* Width of left and right fringes.
168 A value of nil or t means use frame values. */ 199 A value of nil or t means use frame values. */
169 Lisp_Object left_fringe_width, right_fringe_width; 200 Lisp_Object left_fringe_width, right_fringe_width;
170 201 /* Non-nil means fringes are drawn outside display margins;
171 /* Non-nil means fringes are drawn outside display margins; 202 othersize draw them between margin areas and text. */
172 othersize draw them between margin areas and text. */
173 Lisp_Object fringes_outside_margins; 203 Lisp_Object fringes_outside_margins;
174 204
175 /* Pixel width of scroll bars. 205 /* Pixel width of scroll bars.
176 A value of nil or t means use frame values. */ 206 A value of nil or t means use frame values. */
177 Lisp_Object scroll_bar_width; 207 Lisp_Object scroll_bar_width;
208
178 /* Type of vertical scroll bar. A value of nil means 209 /* Type of vertical scroll bar. A value of nil means
179 no scroll bar. A value of t means use frame value. */ 210 no scroll bar. A value of t means use frame value. */
180 Lisp_Object vertical_scroll_bar_type; 211 Lisp_Object vertical_scroll_bar_type;
@@ -183,6 +214,7 @@ struct window
183 /* May be nil if mark does not exist or was not on frame */ 214 /* May be nil if mark does not exist or was not on frame */
184 Lisp_Object last_mark_x; 215 Lisp_Object last_mark_x;
185 Lisp_Object last_mark_y; 216 Lisp_Object last_mark_y;
217
186 /* Z - the buffer position of the last glyph in the current matrix 218 /* Z - the buffer position of the last glyph in the current matrix
187 of W. Only valid if WINDOW_END_VALID is not nil. */ 219 of W. Only valid if WINDOW_END_VALID is not nil. */
188 Lisp_Object window_end_pos; 220 Lisp_Object window_end_pos;
@@ -194,30 +226,38 @@ struct window
194 since in that case the frame image that window_end_pos 226 since in that case the frame image that window_end_pos
195 did not get onto the frame. */ 227 did not get onto the frame. */
196 Lisp_Object window_end_valid; 228 Lisp_Object window_end_valid;
229
197 /* Non-nil means must regenerate mode line of this window */ 230 /* Non-nil means must regenerate mode line of this window */
198 Lisp_Object update_mode_line; 231 Lisp_Object update_mode_line;
232
199 /* Non-nil means current value of `start' 233 /* Non-nil means current value of `start'
200 was the beginning of a line when it was chosen. */ 234 was the beginning of a line when it was chosen. */
201 Lisp_Object start_at_line_beg; 235 Lisp_Object start_at_line_beg;
236
202 /* Display-table to use for displaying chars in this window. 237 /* Display-table to use for displaying chars in this window.
203 Nil means use the buffer's own display-table. */ 238 Nil means use the buffer's own display-table. */
204 Lisp_Object display_table; 239 Lisp_Object display_table;
240
205 /* Non-nil means window is marked as dedicated. */ 241 /* Non-nil means window is marked as dedicated. */
206 Lisp_Object dedicated; 242 Lisp_Object dedicated;
207 /* Line number and position of a line somewhere above the 243
208 top of the screen. */ 244 /* Line number and position of a line somewhere above the top of the
209 /* If this field is nil, it means we don't have a base line. */ 245 screen. If this field is nil, it means we don't have a base
246 line. */
210 Lisp_Object base_line_number; 247 Lisp_Object base_line_number;
211 /* If this field is nil, it means we don't have a base line. 248 /* If this field is nil, it means we don't have a base line.
212 If it is a buffer, it means don't display the line number 249 If it is a buffer, it means don't display the line number
213 as long as the window shows that buffer. */ 250 as long as the window shows that buffer. */
214 Lisp_Object base_line_pos; 251 Lisp_Object base_line_pos;
252
215 /* If we have highlighted the region (or any part of it), 253 /* If we have highlighted the region (or any part of it),
216 this is the mark position that we used, as an integer. */ 254 this is the mark position that we used, as an integer. */
217 Lisp_Object region_showing; 255 Lisp_Object region_showing;
256
218 /* The column number currently displayed in this window's mode line, 257 /* The column number currently displayed in this window's mode line,
219 or nil if column numbers are not being displayed. */ 258 or nil if column numbers are not being displayed. */
220 Lisp_Object column_number_displayed; 259 Lisp_Object column_number_displayed;
260
221 /* If redisplay in this window goes beyond this buffer position, 261 /* If redisplay in this window goes beyond this buffer position,
222 must run the redisplay-end-trigger-hook. */ 262 must run the redisplay-end-trigger-hook. */
223 Lisp_Object redisplay_end_trigger; 263 Lisp_Object redisplay_end_trigger;
@@ -228,6 +268,21 @@ struct window
228 /* Original window height and top before mini-window was enlarged. */ 268 /* Original window height and top before mini-window was enlarged. */
229 Lisp_Object orig_total_lines, orig_top_line; 269 Lisp_Object orig_total_lines, orig_top_line;
230 270
271 /* Non-nil means deleting or resizing this window distributes
272 space among all windows in the same combination. */
273 Lisp_Object splits;
274
275 /* Non-nil means this window's child windows are never
276 (re-)combined. */
277 Lisp_Object nest;
278
279 /* Alist of <buffer, window-start, window-point> triples listing
280 buffers previously shown in this window. */
281 Lisp_Object prev_buffers;
282
283 /* List of buffers re-shown in this window. */
284 Lisp_Object next_buffers;
285
231 /* An alist with parameteres. */ 286 /* An alist with parameteres. */
232 Lisp_Object window_parameters; 287 Lisp_Object window_parameters;
233 288
@@ -361,6 +416,17 @@ struct window
361#define WINDOW_TOTAL_HEIGHT(W) \ 416#define WINDOW_TOTAL_HEIGHT(W) \
362 (WINDOW_TOTAL_LINES (W) * WINDOW_FRAME_LINE_HEIGHT (W)) 417 (WINDOW_TOTAL_LINES (W) * WINDOW_FRAME_LINE_HEIGHT (W))
363 418
419/* For HORFLAG non-zero the total number of columns of window W. Otherwise
420 the total number of lines of W. */
421
422#define WINDOW_TOTAL_SIZE(w, horflag) \
423 (horflag ? WINDOW_TOTAL_COLS (w) : WINDOW_TOTAL_LINES (w))
424
425/* The smallest acceptable dimensions for a window. Anything smaller
426 might crash Emacs. */
427
428#define MIN_SAFE_WINDOW_WIDTH (2)
429#define MIN_SAFE_WINDOW_HEIGHT (1)
364 430
365/* Return the canonical frame column at which window W starts. 431/* Return the canonical frame column at which window W starts.
366 This includes a left-hand scroll bar, if any. */ 432 This includes a left-hand scroll bar, if any. */
@@ -770,7 +836,7 @@ EXFUN (Fwindow_dedicated_p, 1);
770extern void set_window_height (Lisp_Object, int, int); 836extern void set_window_height (Lisp_Object, int, int);
771extern void set_window_width (Lisp_Object, int, int); 837extern void set_window_width (Lisp_Object, int, int);
772extern void change_window_heights (Lisp_Object, int); 838extern void change_window_heights (Lisp_Object, int);
773extern void delete_all_subwindows (struct window *); 839extern void delete_all_subwindows (Lisp_Object);
774extern void freeze_window_starts (struct frame *, int); 840extern void freeze_window_starts (struct frame *, int);
775extern void grow_mini_window (struct window *, int); 841extern void grow_mini_window (struct window *, int);
776extern void shrink_mini_window (struct window *); 842extern void shrink_mini_window (struct window *);
@@ -859,6 +925,7 @@ extern int compare_window_configurations (Lisp_Object, Lisp_Object, int);
859EXFUN (Fpos_visible_in_window_p, 3); 925EXFUN (Fpos_visible_in_window_p, 3);
860extern void mark_window_cursors_off (struct window *); 926extern void mark_window_cursors_off (struct window *);
861extern int window_internal_height (struct window *); 927extern int window_internal_height (struct window *);
928extern int window_body_cols (struct window *w);
862EXFUN (Frecenter, 1); 929EXFUN (Frecenter, 1);
863extern void temp_output_buffer_show (Lisp_Object); 930extern void temp_output_buffer_show (Lisp_Object);
864extern void replace_buffer_in_all_windows (Lisp_Object); 931extern void replace_buffer_in_all_windows (Lisp_Object);
@@ -867,6 +934,4 @@ extern void init_window (void);
867extern void syms_of_window (void); 934extern void syms_of_window (void);
868extern void keys_of_window (void); 935extern void keys_of_window (void);
869 936
870extern int window_box_text_cols (struct window *w);
871
872#endif /* not WINDOW_H_INCLUDED */ 937#endif /* not WINDOW_H_INCLUDED */