aboutsummaryrefslogtreecommitdiffstats
path: root/src/window.c
diff options
context:
space:
mode:
authorJoakim Verona2011-11-07 10:03:00 +0100
committerJoakim Verona2011-11-07 10:03:00 +0100
commitc649990b73768c7a024e111d8c63246030647b53 (patch)
treee5b47169dfc679b53fed30bbd66e2df98de2f02c /src/window.c
parentc823c667cd00b9d8036ce06b943f58f3f4efd7d9 (diff)
parentca78dc431fff3bc2a4f33f2a0fc1449608568d23 (diff)
downloademacs-c649990b73768c7a024e111d8c63246030647b53.tar.gz
emacs-c649990b73768c7a024e111d8c63246030647b53.zip
upstream
Diffstat (limited to 'src/window.c')
-rw-r--r--src/window.c129
1 files changed, 66 insertions, 63 deletions
diff --git a/src/window.c b/src/window.c
index 496a4e6c6ea..5cc77fb8f02 100644
--- a/src/window.c
+++ b/src/window.c
@@ -161,7 +161,8 @@ DEFUN ("windowp", Fwindowp, Swindowp, 1, 1, 0,
161 161
162DEFUN ("window-live-p", Fwindow_live_p, Swindow_live_p, 1, 1, 0, 162DEFUN ("window-live-p", Fwindow_live_p, Swindow_live_p, 1, 1, 0,
163 doc: /* Return t if OBJECT is a live window and nil otherwise. 163 doc: /* Return t if OBJECT is a live window and nil otherwise.
164A live window is a window that displays a buffer. */) 164A live window is a window that displays a buffer.
165Internal windows and deleted windows are not live. */)
165 (Lisp_Object object) 166 (Lisp_Object object)
166{ 167{
167 return WINDOW_LIVE_P (object) ? Qt : Qnil; 168 return WINDOW_LIVE_P (object) ? Qt : Qnil;
@@ -170,7 +171,7 @@ A live window is a window that displays a buffer. */)
170/* Frames and windows. */ 171/* Frames and windows. */
171DEFUN ("window-frame", Fwindow_frame, Swindow_frame, 1, 1, 0, 172DEFUN ("window-frame", Fwindow_frame, Swindow_frame, 1, 1, 0,
172 doc: /* Return the frame that window WINDOW is on. 173 doc: /* Return the frame that window WINDOW is on.
173WINDOW can be any window and defaults to the selected one. */) 174If WINDOW is omitted or nil, it defaults to the selected window. */)
174 (Lisp_Object window) 175 (Lisp_Object window)
175{ 176{
176 return decode_any_window (window)->frame; 177 return decode_any_window (window)->frame;
@@ -179,9 +180,8 @@ WINDOW can be any window and defaults to the selected one. */)
179DEFUN ("frame-root-window", Fframe_root_window, Sframe_root_window, 0, 1, 0, 180DEFUN ("frame-root-window", Fframe_root_window, Sframe_root_window, 0, 1, 0,
180 doc: /* Return the root window of FRAME-OR-WINDOW. 181 doc: /* Return the root window of FRAME-OR-WINDOW.
181If omitted, FRAME-OR-WINDOW defaults to the currently selected frame. 182If omitted, FRAME-OR-WINDOW defaults to the currently selected frame.
182Else if FRAME-OR-WINDOW denotes any window, return the root window of 183With a frame argument, return that frame's root window.
183that window's frame. If FRAME-OR-WINDOW denotes a live frame, return 184With a window argument, return the root window of that window's frame. */)
184the root window of that frame. */)
185 (Lisp_Object frame_or_window) 185 (Lisp_Object frame_or_window)
186{ 186{
187 Lisp_Object window; 187 Lisp_Object window;
@@ -200,9 +200,8 @@ the root window of that frame. */)
200} 200}
201 201
202DEFUN ("minibuffer-window", Fminibuffer_window, Sminibuffer_window, 0, 1, 0, 202DEFUN ("minibuffer-window", Fminibuffer_window, Sminibuffer_window, 0, 1, 0,
203 doc: /* Return the window used now for minibuffers. 203 doc: /* Return the minibuffer window for frame FRAME.
204If the optional argument FRAME is specified, return the minibuffer window 204If FRAME is omitted or nil, it defaults to the selected frame. */)
205used by that frame. */)
206 (Lisp_Object frame) 205 (Lisp_Object frame)
207{ 206{
208 if (NILP (frame)) 207 if (NILP (frame))
@@ -214,7 +213,7 @@ used by that frame. */)
214DEFUN ("window-minibuffer-p", Fwindow_minibuffer_p, 213DEFUN ("window-minibuffer-p", Fwindow_minibuffer_p,
215 Swindow_minibuffer_p, 0, 1, 0, 214 Swindow_minibuffer_p, 0, 1, 0,
216 doc: /* Return non-nil if WINDOW is a minibuffer window. 215 doc: /* Return non-nil if WINDOW is a minibuffer window.
217WINDOW can be any window and defaults to the selected one. */) 216If WINDOW is omitted or nil, it defaults to the selected window. */)
218 (Lisp_Object window) 217 (Lisp_Object window)
219{ 218{
220 return MINI_WINDOW_P (decode_any_window (window)) ? Qt : Qnil; 219 return MINI_WINDOW_P (decode_any_window (window)) ? Qt : Qnil;
@@ -411,44 +410,48 @@ buffer of the selected window before each command. */)
411} 410}
412 411
413DEFUN ("window-buffer", Fwindow_buffer, Swindow_buffer, 0, 1, 0, 412DEFUN ("window-buffer", Fwindow_buffer, Swindow_buffer, 0, 1, 0,
414 doc: /* Return the buffer that WINDOW is displaying. 413 doc: /* Return the buffer displayed in window WINDOW.
415WINDOW can be any window and defaults to the selected one. 414If WINDOW is omitted or nil, it defaults to the selected window.
416If WINDOW is an internal window return nil. */) 415Return nil for an internal window or a deleted window. */)
417 (Lisp_Object window) 416 (Lisp_Object window)
418{ 417{
419 return decode_any_window (window)->buffer; 418 return decode_any_window (window)->buffer;
420} 419}
421 420
422DEFUN ("window-parent", Fwindow_parent, Swindow_parent, 0, 1, 0, 421DEFUN ("window-parent", Fwindow_parent, Swindow_parent, 0, 1, 0,
423 doc: /* Return WINDOW's parent window. 422 doc: /* Return the parent window of window WINDOW.
424WINDOW can be any window and defaults to the selected one. 423If WINDOW is omitted or nil, it defaults to the selected window.
425Return nil if WINDOW has no parent. */) 424Return nil for a window with no parent (e.g. a root window). */)
426 (Lisp_Object window) 425 (Lisp_Object window)
427{ 426{
428 return decode_any_window (window)->parent; 427 return decode_any_window (window)->parent;
429} 428}
430 429
431DEFUN ("window-top-child", Fwindow_top_child, Swindow_top_child, 0, 1, 0, 430DEFUN ("window-top-child", Fwindow_top_child, Swindow_top_child, 1, 1, 0,
432 doc: /* Return WINDOW's topmost child window. 431 doc: /* Return the topmost child window of window WINDOW.
433WINDOW can be any window and defaults to the selected one. 432Return nil if WINDOW is a live window (live windows have no children).
434Return nil if WINDOW is not a vertical combination. */) 433Return nil if WINDOW is an internal window whose children form a
434horizontal combination. */)
435 (Lisp_Object window) 435 (Lisp_Object window)
436{ 436{
437 CHECK_WINDOW (window);
437 return decode_any_window (window)->vchild; 438 return decode_any_window (window)->vchild;
438} 439}
439 440
440DEFUN ("window-left-child", Fwindow_left_child, Swindow_left_child, 0, 1, 0, 441DEFUN ("window-left-child", Fwindow_left_child, Swindow_left_child, 1, 1, 0,
441 doc: /* Return WINDOW's leftmost child window. 442 doc: /* Return the leftmost child window of window WINDOW.
442WINDOW can be any window and defaults to the selected one. 443Return nil if WINDOW is a live window (live windows have no children).
443Return nil if WINDOW is not a horizontal combination. */) 444Return nil if WINDOW is an internal window whose children form a
445vertical combination. */)
444 (Lisp_Object window) 446 (Lisp_Object window)
445{ 447{
448 CHECK_WINDOW (window);
446 return decode_any_window (window)->hchild; 449 return decode_any_window (window)->hchild;
447} 450}
448 451
449DEFUN ("window-next-sibling", Fwindow_next_sibling, Swindow_next_sibling, 0, 1, 0, 452DEFUN ("window-next-sibling", Fwindow_next_sibling, Swindow_next_sibling, 0, 1, 0,
450 doc: /* Return WINDOW's next sibling window. 453 doc: /* Return the next sibling window of window WINDOW.
451WINDOW can be any window and defaults to the selected one. 454If WINDOW is omitted or nil, it defaults to the selected window.
452Return nil if WINDOW has no next sibling. */) 455Return nil if WINDOW has no next sibling. */)
453 (Lisp_Object window) 456 (Lisp_Object window)
454{ 457{
@@ -456,8 +459,8 @@ Return nil if WINDOW has no next sibling. */)
456} 459}
457 460
458DEFUN ("window-prev-sibling", Fwindow_prev_sibling, Swindow_prev_sibling, 0, 1, 0, 461DEFUN ("window-prev-sibling", Fwindow_prev_sibling, Swindow_prev_sibling, 0, 1, 0,
459 doc: /* Return WINDOW's previous sibling window. 462 doc: /* Return the previous sibling window of window WINDOW.
460WINDOW can be any window and defaults to the selected one. 463If WINDOW is omitted or nil, it defaults to the selected window.
461Return nil if WINDOW has no previous sibling. */) 464Return nil if WINDOW has no previous sibling. */)
462 (Lisp_Object window) 465 (Lisp_Object window)
463{ 466{
@@ -465,8 +468,8 @@ Return nil if WINDOW has no previous sibling. */)
465} 468}
466 469
467DEFUN ("window-splits", Fwindow_splits, Swindow_splits, 0, 1, 0, 470DEFUN ("window-splits", Fwindow_splits, Swindow_splits, 0, 1, 0,
468 doc: /* Return splits status for WINDOW. 471 doc: /* Return splits status for the window WINDOW.
469WINDOW can be any window and defaults to the selected one. 472If WINDOW is omitted or nil, it defaults to the selected window.
470 473
471If the value returned by this function is nil and WINDOW is resized, the 474If the value returned by this function is nil and WINDOW is resized, the
472corresponding space is preferably taken from (or given to) WINDOW's 475corresponding space is preferably taken from (or given to) WINDOW's
@@ -481,9 +484,8 @@ WINDOW may resize all windows in the same combination. */)
481} 484}
482 485
483DEFUN ("set-window-splits", Fset_window_splits, Sset_window_splits, 2, 2, 0, 486DEFUN ("set-window-splits", Fset_window_splits, Sset_window_splits, 2, 2, 0,
484 doc: /* Set splits status of WINDOW to STATUS. 487 doc: /* Set splits status of window WINDOW to STATUS.
485WINDOW can be any window and defaults to the selected one. Return 488If WINDOW is omitted or nil, it defaults to the selected window.
486STATUS.
487 489
488If STATUS is nil and WINDOW is later resized, the corresponding space is 490If STATUS is nil and WINDOW is later resized, the corresponding space is
489preferably taken from (or given to) WINDOW's right sibling. When WINDOW 491preferably taken from (or given to) WINDOW's right sibling. When WINDOW
@@ -501,8 +503,8 @@ windows in the same combination. */)
501} 503}
502 504
503DEFUN ("window-nest", Fwindow_nest, Swindow_nest, 0, 1, 0, 505DEFUN ("window-nest", Fwindow_nest, Swindow_nest, 0, 1, 0,
504 doc: /* Return nest status of WINDOW. 506 doc: /* Return nest status of window WINDOW.
505WINDOW can be any window and defaults to the selected one. 507If WINDOW is omitted or nil, it defaults to the selected window.
506 508
507If the return value is nil, subwindows of WINDOW can be recombined with 509If the return value is nil, subwindows of WINDOW can be recombined with
508WINDOW's siblings. A return value of non-nil means that subwindows of 510WINDOW's siblings. A return value of non-nil means that subwindows of
@@ -513,9 +515,8 @@ WINDOW are never \(re-)combined with WINDOW's siblings. */)
513} 515}
514 516
515DEFUN ("set-window-nest", Fset_window_nest, Sset_window_nest, 2, 2, 0, 517DEFUN ("set-window-nest", Fset_window_nest, Sset_window_nest, 2, 2, 0,
516 doc: /* Set nest status of WINDOW to STATUS. 518 doc: /* Set nest status of window WINDOW to STATUS; return STATUS.
517WINDOW can be any window and defaults to the selected one. Return 519If WINDOW is omitted or nil, it defaults to the selected window.
518STATUS.
519 520
520If STATUS is nil, subwindows of WINDOW can be recombined with WINDOW's 521If STATUS is nil, subwindows of WINDOW can be recombined with WINDOW's
521siblings. STATUS non-nil means that subwindows of WINDOW are never 522siblings. STATUS non-nil means that subwindows of WINDOW are never
@@ -530,22 +531,24 @@ siblings. STATUS non-nil means that subwindows of WINDOW are never
530} 531}
531 532
532DEFUN ("window-use-time", Fwindow_use_time, Swindow_use_time, 0, 1, 0, 533DEFUN ("window-use-time", Fwindow_use_time, Swindow_use_time, 0, 1, 0,
533 doc: /* Return WINDOW's use time. 534 doc: /* Return the use time of window WINDOW.
534WINDOW defaults to the selected window. The window with the highest use 535If WINDOW is omitted or nil, it defaults to the selected window.
535time is the most recently selected one. The window with the lowest use 536The window with the highest use time is the most recently selected
536time is the least recently selected one. */) 537one. The window with the lowest use time is the least recently
538selected one. */)
537 (Lisp_Object window) 539 (Lisp_Object window)
538{ 540{
539 return decode_window (window)->use_time; 541 return decode_window (window)->use_time;
540} 542}
541 543
542DEFUN ("window-total-size", Fwindow_total_size, Swindow_total_size, 0, 2, 0, 544DEFUN ("window-total-size", Fwindow_total_size, Swindow_total_size, 0, 2, 0,
543 doc: /* Return the total number of lines of WINDOW. 545 doc: /* Return the total number of lines of window WINDOW.
544WINDOW can be any window and defaults to the selected one. The return 546If WINDOW is omitted or nil, it defaults to the selected window.
545value includes WINDOW's mode line and header line, if any. If WINDOW 547
546is internal, the return value is the sum of the total number of lines 548The return value includes WINDOW's mode line and header line, if any.
547of WINDOW's child windows if these are vertically combined and the 549If WINDOW is internal, the return value is the sum of the total number
548height of WINDOW's first child otherwise. 550of lines of WINDOW's child windows if these are vertically combined
551and the height of WINDOW's first child otherwise.
549 552
550Optional argument HORIZONTAL non-nil means return the total number of 553Optional argument HORIZONTAL non-nil means return the total number of
551columns of WINDOW. In this case the return value includes any vertical 554columns of WINDOW. In this case the return value includes any vertical
@@ -562,17 +565,17 @@ first child otherwise. */)
562} 565}
563 566
564DEFUN ("window-new-total", Fwindow_new_total, Swindow_new_total, 0, 1, 0, 567DEFUN ("window-new-total", Fwindow_new_total, Swindow_new_total, 0, 1, 0,
565 doc: /* Return new total size of WINDOW. 568 doc: /* Return the new total size of window WINDOW.
566WINDOW defaults to the selected window. */) 569If WINDOW is omitted or nil, it defaults to the selected window. */)
567 (Lisp_Object window) 570 (Lisp_Object window)
568{ 571{
569 return decode_any_window (window)->new_total; 572 return decode_any_window (window)->new_total;
570} 573}
571 574
572DEFUN ("window-normal-size", Fwindow_normal_size, Swindow_normal_size, 0, 2, 0, 575DEFUN ("window-normal-size", Fwindow_normal_size, Swindow_normal_size, 0, 2, 0,
573 doc: /* Return normal height of WINDOW. 576 doc: /* Return the normal height of window WINDOW.
574WINDOW can be any window and defaults to the selected one. Optional 577If WINDOW is omitted or nil, it defaults to the selected window.
575argument HORIZONTAL non-nil means return normal width of WINDOW. */) 578If HORIZONTAL is non-nil, return the normal width of WINDOW. */)
576 (Lisp_Object window, Lisp_Object horizontal) 579 (Lisp_Object window, Lisp_Object horizontal)
577{ 580{
578 if (NILP (horizontal)) 581 if (NILP (horizontal))
@@ -582,24 +585,24 @@ argument HORIZONTAL non-nil means return normal width of WINDOW. */)
582} 585}
583 586
584DEFUN ("window-new-normal", Fwindow_new_normal, Swindow_new_normal, 0, 1, 0, 587DEFUN ("window-new-normal", Fwindow_new_normal, Swindow_new_normal, 0, 1, 0,
585 doc: /* Return new normal size of WINDOW. 588 doc: /* Return new normal size of window WINDOW.
586WINDOW can be any window and defaults to the selected one. */) 589If WINDOW is omitted or nil, it defaults to the selected window. */)
587 (Lisp_Object window) 590 (Lisp_Object window)
588{ 591{
589 return decode_any_window (window)->new_normal; 592 return decode_any_window (window)->new_normal;
590} 593}
591 594
592DEFUN ("window-left-column", Fwindow_left_column, Swindow_left_column, 0, 1, 0, 595DEFUN ("window-left-column", Fwindow_left_column, Swindow_left_column, 0, 1, 0,
593 doc: /* Return left column of WINDOW. 596 doc: /* Return left column of window WINDOW.
594WINDOW can be any window and defaults to the selected one. */) 597If WINDOW is omitted or nil, it defaults to the selected window. */)
595 (Lisp_Object window) 598 (Lisp_Object window)
596{ 599{
597 return decode_any_window (window)->left_col; 600 return decode_any_window (window)->left_col;
598} 601}
599 602
600DEFUN ("window-top-line", Fwindow_top_line, Swindow_top_line, 0, 1, 0, 603DEFUN ("window-top-line", Fwindow_top_line, Swindow_top_line, 0, 1, 0,
601 doc: /* Return top line of WINDOW. 604 doc: /* Return top line of window WINDOW.
602WINDOW can be any window and defaults to the selected one. */) 605If WINDOW is omitted or nil, it defaults to the selected window. */)
603 (Lisp_Object window) 606 (Lisp_Object window)
604{ 607{
605 return decode_any_window (window)->top_line; 608 return decode_any_window (window)->top_line;
@@ -2313,7 +2316,7 @@ window_list_1 (Lisp_Object window, Lisp_Object minibuf, Lisp_Object all_frames)
2313DEFUN ("window-list", Fwindow_list, Swindow_list, 0, 3, 0, 2316DEFUN ("window-list", Fwindow_list, Swindow_list, 0, 3, 0,
2314 doc: /* Return a list of windows on FRAME, starting with WINDOW. 2317 doc: /* Return a list of windows on FRAME, starting with WINDOW.
2315FRAME nil or omitted means use the selected frame. 2318FRAME nil or omitted means use the selected frame.
2316WINDOW nil or omitted means use the selected window. 2319WINDOW nil or omitted means use the window selected within FRAME.
2317MINIBUF t means include the minibuffer window, even if it isn't active. 2320MINIBUF t means include the minibuffer window, even if it isn't active.
2318MINIBUF nil or omitted means include the minibuffer window only 2321MINIBUF nil or omitted means include the minibuffer window only
2319if it's active. 2322if it's active.
@@ -6007,7 +6010,7 @@ means no margin. */)
6007DEFUN ("window-margins", Fwindow_margins, Swindow_margins, 6010DEFUN ("window-margins", Fwindow_margins, Swindow_margins,
6008 0, 1, 0, 6011 0, 1, 0,
6009 doc: /* Get width of marginal areas of window WINDOW. 6012 doc: /* Get width of marginal areas of window WINDOW.
6010If WINDOW is omitted or nil, use the currently selected window. 6013If WINDOW is omitted or nil, it defaults to the selected window.
6011Value is a cons of the form (LEFT-WIDTH . RIGHT-WIDTH). 6014Value is a cons of the form (LEFT-WIDTH . RIGHT-WIDTH).
6012If a marginal area does not exist, its width will be returned 6015If a marginal area does not exist, its width will be returned
6013as nil. */) 6016as nil. */)
@@ -6071,7 +6074,7 @@ display marginal areas and the text area. */)
6071DEFUN ("window-fringes", Fwindow_fringes, Swindow_fringes, 6074DEFUN ("window-fringes", Fwindow_fringes, Swindow_fringes,
6072 0, 1, 0, 6075 0, 1, 0,
6073 doc: /* Get width of fringes of window WINDOW. 6076 doc: /* Get width of fringes of window WINDOW.
6074If WINDOW is omitted or nil, use the currently selected window. 6077If WINDOW is omitted or nil, it defaults to the selected window.
6075Value is a list of the form (LEFT-WIDTH RIGHT-WIDTH OUTSIDE-MARGINS). */) 6078Value is a list of the form (LEFT-WIDTH RIGHT-WIDTH OUTSIDE-MARGINS). */)
6076 (Lisp_Object window) 6079 (Lisp_Object window)
6077{ 6080{
@@ -6140,7 +6143,7 @@ Fourth parameter HORIZONTAL-TYPE is currently unused. */)
6140DEFUN ("window-scroll-bars", Fwindow_scroll_bars, Swindow_scroll_bars, 6143DEFUN ("window-scroll-bars", Fwindow_scroll_bars, Swindow_scroll_bars,
6141 0, 1, 0, 6144 0, 1, 0,
6142 doc: /* Get width and type of scroll bars of window WINDOW. 6145 doc: /* Get width and type of scroll bars of window WINDOW.
6143If WINDOW is omitted or nil, use the currently selected window. 6146If WINDOW is omitted or nil, it defaults to the selected window.
6144Value is a list of the form (WIDTH COLS VERTICAL-TYPE HORIZONTAL-TYPE). 6147Value is a list of the form (WIDTH COLS VERTICAL-TYPE HORIZONTAL-TYPE).
6145If WIDTH is nil or TYPE is t, the window is using the frame's corresponding 6148If WIDTH is nil or TYPE is t, the window is using the frame's corresponding
6146value. */) 6149value. */)
@@ -6163,7 +6166,7 @@ value. */)
6163 6166
6164DEFUN ("window-vscroll", Fwindow_vscroll, Swindow_vscroll, 0, 2, 0, 6167DEFUN ("window-vscroll", Fwindow_vscroll, Swindow_vscroll, 0, 2, 0,
6165 doc: /* Return the amount by which WINDOW is scrolled vertically. 6168 doc: /* Return the amount by which WINDOW is scrolled vertically.
6166Use the selected window if WINDOW is nil or omitted. 6169If WINDOW is omitted or nil, it defaults to the selected window.
6167Normally, value is a multiple of the canonical character height of WINDOW; 6170Normally, value is a multiple of the canonical character height of WINDOW;
6168optional second arg PIXELS-P means value is measured in pixels. */) 6171optional second arg PIXELS-P means value is measured in pixels. */)
6169 (Lisp_Object window, Lisp_Object pixels_p) 6172 (Lisp_Object window, Lisp_Object pixels_p)