aboutsummaryrefslogtreecommitdiffstats
path: root/src/window.c
diff options
context:
space:
mode:
authorChong Yidong2011-11-06 11:59:53 +0800
committerChong Yidong2011-11-06 11:59:53 +0800
commit49745b39a15ecc32f4956c2d91530f196d9cd638 (patch)
treedea6f8efd8e64595fb4dd1227d4965994937ca09 /src/window.c
parent1f05cd82d2e3c79ecede95aef578d1f395549b22 (diff)
downloademacs-49745b39a15ecc32f4956c2d91530f196d9cd638.tar.gz
emacs-49745b39a15ecc32f4956c2d91530f196d9cd638.zip
Delete window-combination-p; tweaks to window-top-child and window-left-child.
* lisp/window.el (window-combination-p): Function deleted; its side-effect is not used in any existing code. (window-combinations, window-combined-p): Call window-*-child directly. * window.c (Fwindow_live_p, Fwindow_frame, Fframe_root_window) (Fminibuffer_window, Fwindow_buffer, Fwindow_splits) (Fset_window_splits, Fwindow_nest, Fset_window_nest) (Fwindow_use_time, Fwindow_total_size, Fwindow_normal_size) (Fwindow_new_normal, Fwindow_left_column, Fwindow_top_line) (Fwindow_margins, Fwindow_fringes, Fwindow_scroll_bars) (Fwindow_vscroll): Doc fix. (Fwindow_top_child, Fwindow_left_child): Eliminate a nil default argument, since it makes no sense to pass a live window and for consistency with window-child.
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 6b3b7f2a471..605d00b8e05 100644
--- a/src/window.c
+++ b/src/window.c
@@ -159,7 +159,8 @@ DEFUN ("windowp", Fwindowp, Swindowp, 1, 1, 0,
159 159
160DEFUN ("window-live-p", Fwindow_live_p, Swindow_live_p, 1, 1, 0, 160DEFUN ("window-live-p", Fwindow_live_p, Swindow_live_p, 1, 1, 0,
161 doc: /* Return t if OBJECT is a live window and nil otherwise. 161 doc: /* Return t if OBJECT is a live window and nil otherwise.
162A live window is a window that displays a buffer. */) 162A live window is a window that displays a buffer.
163Internal windows and deleted windows are not live. */)
163 (Lisp_Object object) 164 (Lisp_Object object)
164{ 165{
165 return WINDOW_LIVE_P (object) ? Qt : Qnil; 166 return WINDOW_LIVE_P (object) ? Qt : Qnil;
@@ -168,7 +169,7 @@ A live window is a window that displays a buffer. */)
168/* Frames and windows. */ 169/* Frames and windows. */
169DEFUN ("window-frame", Fwindow_frame, Swindow_frame, 1, 1, 0, 170DEFUN ("window-frame", Fwindow_frame, Swindow_frame, 1, 1, 0,
170 doc: /* Return the frame that window WINDOW is on. 171 doc: /* Return the frame that window WINDOW is on.
171WINDOW can be any window and defaults to the selected one. */) 172If WINDOW is omitted or nil, it defaults to the selected window. */)
172 (Lisp_Object window) 173 (Lisp_Object window)
173{ 174{
174 return decode_any_window (window)->frame; 175 return decode_any_window (window)->frame;
@@ -177,9 +178,8 @@ WINDOW can be any window and defaults to the selected one. */)
177DEFUN ("frame-root-window", Fframe_root_window, Sframe_root_window, 0, 1, 0, 178DEFUN ("frame-root-window", Fframe_root_window, Sframe_root_window, 0, 1, 0,
178 doc: /* Return the root window of FRAME-OR-WINDOW. 179 doc: /* Return the root window of FRAME-OR-WINDOW.
179If omitted, FRAME-OR-WINDOW defaults to the currently selected frame. 180If omitted, FRAME-OR-WINDOW defaults to the currently selected frame.
180Else if FRAME-OR-WINDOW denotes any window, return the root window of 181With a frame argument, return that frame's root window.
181that window's frame. If FRAME-OR-WINDOW denotes a live frame, return 182With a window argument, return the root window of that window's frame. */)
182the root window of that frame. */)
183 (Lisp_Object frame_or_window) 183 (Lisp_Object frame_or_window)
184{ 184{
185 Lisp_Object window; 185 Lisp_Object window;
@@ -198,9 +198,8 @@ the root window of that frame. */)
198} 198}
199 199
200DEFUN ("minibuffer-window", Fminibuffer_window, Sminibuffer_window, 0, 1, 0, 200DEFUN ("minibuffer-window", Fminibuffer_window, Sminibuffer_window, 0, 1, 0,
201 doc: /* Return the window used now for minibuffers. 201 doc: /* Return the minibuffer window for frame FRAME.
202If the optional argument FRAME is specified, return the minibuffer window 202If FRAME is omitted or nil, it defaults to the selected frame. */)
203used by that frame. */)
204 (Lisp_Object frame) 203 (Lisp_Object frame)
205{ 204{
206 if (NILP (frame)) 205 if (NILP (frame))
@@ -212,7 +211,7 @@ used by that frame. */)
212DEFUN ("window-minibuffer-p", Fwindow_minibuffer_p, 211DEFUN ("window-minibuffer-p", Fwindow_minibuffer_p,
213 Swindow_minibuffer_p, 0, 1, 0, 212 Swindow_minibuffer_p, 0, 1, 0,
214 doc: /* Return non-nil if WINDOW is a minibuffer window. 213 doc: /* Return non-nil if WINDOW is a minibuffer window.
215WINDOW can be any window and defaults to the selected one. */) 214If WINDOW is omitted or nil, it defaults to the selected window. */)
216 (Lisp_Object window) 215 (Lisp_Object window)
217{ 216{
218 return MINI_WINDOW_P (decode_any_window (window)) ? Qt : Qnil; 217 return MINI_WINDOW_P (decode_any_window (window)) ? Qt : Qnil;
@@ -409,44 +408,48 @@ buffer of the selected window before each command. */)
409} 408}
410 409
411DEFUN ("window-buffer", Fwindow_buffer, Swindow_buffer, 0, 1, 0, 410DEFUN ("window-buffer", Fwindow_buffer, Swindow_buffer, 0, 1, 0,
412 doc: /* Return the buffer that WINDOW is displaying. 411 doc: /* Return the buffer displayed in window WINDOW.
413WINDOW can be any window and defaults to the selected one. 412If WINDOW is omitted or nil, it defaults to the selected window.
414If WINDOW is an internal window return nil. */) 413Return nil for an internal window or a deleted window. */)
415 (Lisp_Object window) 414 (Lisp_Object window)
416{ 415{
417 return decode_any_window (window)->buffer; 416 return decode_any_window (window)->buffer;
418} 417}
419 418
420DEFUN ("window-parent", Fwindow_parent, Swindow_parent, 0, 1, 0, 419DEFUN ("window-parent", Fwindow_parent, Swindow_parent, 0, 1, 0,
421 doc: /* Return WINDOW's parent window. 420 doc: /* Return the parent window of window WINDOW.
422WINDOW can be any window and defaults to the selected one. 421If WINDOW is omitted or nil, it defaults to the selected window.
423Return nil if WINDOW has no parent. */) 422Return nil for a window with no parent (e.g. a root window). */)
424 (Lisp_Object window) 423 (Lisp_Object window)
425{ 424{
426 return decode_any_window (window)->parent; 425 return decode_any_window (window)->parent;
427} 426}
428 427
429DEFUN ("window-top-child", Fwindow_top_child, Swindow_top_child, 0, 1, 0, 428DEFUN ("window-top-child", Fwindow_top_child, Swindow_top_child, 1, 1, 0,
430 doc: /* Return WINDOW's topmost child window. 429 doc: /* Return the topmost child window of window WINDOW.
431WINDOW can be any window and defaults to the selected one. 430Return nil if WINDOW is a live window (live windows have no children).
432Return nil if WINDOW is not a vertical combination. */) 431Return nil if WINDOW is an internal window whose children form a
432horizontal combination. */)
433 (Lisp_Object window) 433 (Lisp_Object window)
434{ 434{
435 CHECK_WINDOW (window);
435 return decode_any_window (window)->vchild; 436 return decode_any_window (window)->vchild;
436} 437}
437 438
438DEFUN ("window-left-child", Fwindow_left_child, Swindow_left_child, 0, 1, 0, 439DEFUN ("window-left-child", Fwindow_left_child, Swindow_left_child, 1, 1, 0,
439 doc: /* Return WINDOW's leftmost child window. 440 doc: /* Return the leftmost child window of window WINDOW.
440WINDOW can be any window and defaults to the selected one. 441Return nil if WINDOW is a live window (live windows have no children).
441Return nil if WINDOW is not a horizontal combination. */) 442Return nil if WINDOW is an internal window whose children form a
443vertical combination. */)
442 (Lisp_Object window) 444 (Lisp_Object window)
443{ 445{
446 CHECK_WINDOW (window);
444 return decode_any_window (window)->hchild; 447 return decode_any_window (window)->hchild;
445} 448}
446 449
447DEFUN ("window-next-sibling", Fwindow_next_sibling, Swindow_next_sibling, 0, 1, 0, 450DEFUN ("window-next-sibling", Fwindow_next_sibling, Swindow_next_sibling, 0, 1, 0,
448 doc: /* Return WINDOW's next sibling window. 451 doc: /* Return the next sibling window of window WINDOW.
449WINDOW can be any window and defaults to the selected one. 452If WINDOW is omitted or nil, it defaults to the selected window.
450Return nil if WINDOW has no next sibling. */) 453Return nil if WINDOW has no next sibling. */)
451 (Lisp_Object window) 454 (Lisp_Object window)
452{ 455{
@@ -454,8 +457,8 @@ Return nil if WINDOW has no next sibling. */)
454} 457}
455 458
456DEFUN ("window-prev-sibling", Fwindow_prev_sibling, Swindow_prev_sibling, 0, 1, 0, 459DEFUN ("window-prev-sibling", Fwindow_prev_sibling, Swindow_prev_sibling, 0, 1, 0,
457 doc: /* Return WINDOW's previous sibling window. 460 doc: /* Return the previous sibling window of window WINDOW.
458WINDOW can be any window and defaults to the selected one. 461If WINDOW is omitted or nil, it defaults to the selected window.
459Return nil if WINDOW has no previous sibling. */) 462Return nil if WINDOW has no previous sibling. */)
460 (Lisp_Object window) 463 (Lisp_Object window)
461{ 464{
@@ -463,8 +466,8 @@ Return nil if WINDOW has no previous sibling. */)
463} 466}
464 467
465DEFUN ("window-splits", Fwindow_splits, Swindow_splits, 0, 1, 0, 468DEFUN ("window-splits", Fwindow_splits, Swindow_splits, 0, 1, 0,
466 doc: /* Return splits status for WINDOW. 469 doc: /* Return splits status for the window WINDOW.
467WINDOW can be any window and defaults to the selected one. 470If WINDOW is omitted or nil, it defaults to the selected window.
468 471
469If the value returned by this function is nil and WINDOW is resized, the 472If the value returned by this function is nil and WINDOW is resized, the
470corresponding space is preferably taken from (or given to) WINDOW's 473corresponding space is preferably taken from (or given to) WINDOW's
@@ -479,9 +482,8 @@ WINDOW may resize all windows in the same combination. */)
479} 482}
480 483
481DEFUN ("set-window-splits", Fset_window_splits, Sset_window_splits, 2, 2, 0, 484DEFUN ("set-window-splits", Fset_window_splits, Sset_window_splits, 2, 2, 0,
482 doc: /* Set splits status of WINDOW to STATUS. 485 doc: /* Set splits status of window WINDOW to STATUS.
483WINDOW can be any window and defaults to the selected one. Return 486If WINDOW is omitted or nil, it defaults to the selected window.
484STATUS.
485 487
486If STATUS is nil and WINDOW is later resized, the corresponding space is 488If STATUS is nil and WINDOW is later resized, the corresponding space is
487preferably taken from (or given to) WINDOW's right sibling. When WINDOW 489preferably taken from (or given to) WINDOW's right sibling. When WINDOW
@@ -499,8 +501,8 @@ windows in the same combination. */)
499} 501}
500 502
501DEFUN ("window-nest", Fwindow_nest, Swindow_nest, 0, 1, 0, 503DEFUN ("window-nest", Fwindow_nest, Swindow_nest, 0, 1, 0,
502 doc: /* Return nest status of WINDOW. 504 doc: /* Return nest status of window WINDOW.
503WINDOW can be any window and defaults to the selected one. 505If WINDOW is omitted or nil, it defaults to the selected window.
504 506
505If the return value is nil, subwindows of WINDOW can be recombined with 507If the return value is nil, subwindows of WINDOW can be recombined with
506WINDOW's siblings. A return value of non-nil means that subwindows of 508WINDOW's siblings. A return value of non-nil means that subwindows of
@@ -511,9 +513,8 @@ WINDOW are never \(re-)combined with WINDOW's siblings. */)
511} 513}
512 514
513DEFUN ("set-window-nest", Fset_window_nest, Sset_window_nest, 2, 2, 0, 515DEFUN ("set-window-nest", Fset_window_nest, Sset_window_nest, 2, 2, 0,
514 doc: /* Set nest status of WINDOW to STATUS. 516 doc: /* Set nest status of window WINDOW to STATUS; return STATUS.
515WINDOW can be any window and defaults to the selected one. Return 517If WINDOW is omitted or nil, it defaults to the selected window.
516STATUS.
517 518
518If STATUS is nil, subwindows of WINDOW can be recombined with WINDOW's 519If STATUS is nil, subwindows of WINDOW can be recombined with WINDOW's
519siblings. STATUS non-nil means that subwindows of WINDOW are never 520siblings. STATUS non-nil means that subwindows of WINDOW are never
@@ -528,22 +529,24 @@ siblings. STATUS non-nil means that subwindows of WINDOW are never
528} 529}
529 530
530DEFUN ("window-use-time", Fwindow_use_time, Swindow_use_time, 0, 1, 0, 531DEFUN ("window-use-time", Fwindow_use_time, Swindow_use_time, 0, 1, 0,
531 doc: /* Return WINDOW's use time. 532 doc: /* Return the use time of window WINDOW.
532WINDOW defaults to the selected window. The window with the highest use 533If WINDOW is omitted or nil, it defaults to the selected window.
533time is the most recently selected one. The window with the lowest use 534The window with the highest use time is the most recently selected
534time is the least recently selected one. */) 535one. The window with the lowest use time is the least recently
536selected one. */)
535 (Lisp_Object window) 537 (Lisp_Object window)
536{ 538{
537 return decode_window (window)->use_time; 539 return decode_window (window)->use_time;
538} 540}
539 541
540DEFUN ("window-total-size", Fwindow_total_size, Swindow_total_size, 0, 2, 0, 542DEFUN ("window-total-size", Fwindow_total_size, Swindow_total_size, 0, 2, 0,
541 doc: /* Return the total number of lines of WINDOW. 543 doc: /* Return the total number of lines of window WINDOW.
542WINDOW can be any window and defaults to the selected one. The return 544If WINDOW is omitted or nil, it defaults to the selected window.
543value includes WINDOW's mode line and header line, if any. If WINDOW 545
544is internal, the return value is the sum of the total number of lines 546The return value includes WINDOW's mode line and header line, if any.
545of WINDOW's child windows if these are vertically combined and the 547If WINDOW is internal, the return value is the sum of the total number
546height of WINDOW's first child otherwise. 548of lines of WINDOW's child windows if these are vertically combined
549and the height of WINDOW's first child otherwise.
547 550
548Optional argument HORIZONTAL non-nil means return the total number of 551Optional argument HORIZONTAL non-nil means return the total number of
549columns of WINDOW. In this case the return value includes any vertical 552columns of WINDOW. In this case the return value includes any vertical
@@ -560,17 +563,17 @@ first child otherwise. */)
560} 563}
561 564
562DEFUN ("window-new-total", Fwindow_new_total, Swindow_new_total, 0, 1, 0, 565DEFUN ("window-new-total", Fwindow_new_total, Swindow_new_total, 0, 1, 0,
563 doc: /* Return new total size of WINDOW. 566 doc: /* Return the new total size of window WINDOW.
564WINDOW defaults to the selected window. */) 567If WINDOW is omitted or nil, it defaults to the selected window. */)
565 (Lisp_Object window) 568 (Lisp_Object window)
566{ 569{
567 return decode_any_window (window)->new_total; 570 return decode_any_window (window)->new_total;
568} 571}
569 572
570DEFUN ("window-normal-size", Fwindow_normal_size, Swindow_normal_size, 0, 2, 0, 573DEFUN ("window-normal-size", Fwindow_normal_size, Swindow_normal_size, 0, 2, 0,
571 doc: /* Return normal height of WINDOW. 574 doc: /* Return the normal height of window WINDOW.
572WINDOW can be any window and defaults to the selected one. Optional 575If WINDOW is omitted or nil, it defaults to the selected window.
573argument HORIZONTAL non-nil means return normal width of WINDOW. */) 576If HORIZONTAL is non-nil, return the normal width of WINDOW. */)
574 (Lisp_Object window, Lisp_Object horizontal) 577 (Lisp_Object window, Lisp_Object horizontal)
575{ 578{
576 if (NILP (horizontal)) 579 if (NILP (horizontal))
@@ -580,24 +583,24 @@ argument HORIZONTAL non-nil means return normal width of WINDOW. */)
580} 583}
581 584
582DEFUN ("window-new-normal", Fwindow_new_normal, Swindow_new_normal, 0, 1, 0, 585DEFUN ("window-new-normal", Fwindow_new_normal, Swindow_new_normal, 0, 1, 0,
583 doc: /* Return new normal size of WINDOW. 586 doc: /* Return new normal size of window WINDOW.
584WINDOW can be any window and defaults to the selected one. */) 587If WINDOW is omitted or nil, it defaults to the selected window. */)
585 (Lisp_Object window) 588 (Lisp_Object window)
586{ 589{
587 return decode_any_window (window)->new_normal; 590 return decode_any_window (window)->new_normal;
588} 591}
589 592
590DEFUN ("window-left-column", Fwindow_left_column, Swindow_left_column, 0, 1, 0, 593DEFUN ("window-left-column", Fwindow_left_column, Swindow_left_column, 0, 1, 0,
591 doc: /* Return left column of WINDOW. 594 doc: /* Return left column of window WINDOW.
592WINDOW can be any window and defaults to the selected one. */) 595If WINDOW is omitted or nil, it defaults to the selected window. */)
593 (Lisp_Object window) 596 (Lisp_Object window)
594{ 597{
595 return decode_any_window (window)->left_col; 598 return decode_any_window (window)->left_col;
596} 599}
597 600
598DEFUN ("window-top-line", Fwindow_top_line, Swindow_top_line, 0, 1, 0, 601DEFUN ("window-top-line", Fwindow_top_line, Swindow_top_line, 0, 1, 0,
599 doc: /* Return top line of WINDOW. 602 doc: /* Return top line of window WINDOW.
600WINDOW can be any window and defaults to the selected one. */) 603If WINDOW is omitted or nil, it defaults to the selected window. */)
601 (Lisp_Object window) 604 (Lisp_Object window)
602{ 605{
603 return decode_any_window (window)->top_line; 606 return decode_any_window (window)->top_line;
@@ -2311,7 +2314,7 @@ window_list_1 (Lisp_Object window, Lisp_Object minibuf, Lisp_Object all_frames)
2311DEFUN ("window-list", Fwindow_list, Swindow_list, 0, 3, 0, 2314DEFUN ("window-list", Fwindow_list, Swindow_list, 0, 3, 0,
2312 doc: /* Return a list of windows on FRAME, starting with WINDOW. 2315 doc: /* Return a list of windows on FRAME, starting with WINDOW.
2313FRAME nil or omitted means use the selected frame. 2316FRAME nil or omitted means use the selected frame.
2314WINDOW nil or omitted means use the selected window. 2317WINDOW nil or omitted means use the window selected within FRAME.
2315MINIBUF t means include the minibuffer window, even if it isn't active. 2318MINIBUF t means include the minibuffer window, even if it isn't active.
2316MINIBUF nil or omitted means include the minibuffer window only 2319MINIBUF nil or omitted means include the minibuffer window only
2317if it's active. 2320if it's active.
@@ -6002,7 +6005,7 @@ means no margin. */)
6002DEFUN ("window-margins", Fwindow_margins, Swindow_margins, 6005DEFUN ("window-margins", Fwindow_margins, Swindow_margins,
6003 0, 1, 0, 6006 0, 1, 0,
6004 doc: /* Get width of marginal areas of window WINDOW. 6007 doc: /* Get width of marginal areas of window WINDOW.
6005If WINDOW is omitted or nil, use the currently selected window. 6008If WINDOW is omitted or nil, it defaults to the selected window.
6006Value is a cons of the form (LEFT-WIDTH . RIGHT-WIDTH). 6009Value is a cons of the form (LEFT-WIDTH . RIGHT-WIDTH).
6007If a marginal area does not exist, its width will be returned 6010If a marginal area does not exist, its width will be returned
6008as nil. */) 6011as nil. */)
@@ -6066,7 +6069,7 @@ display marginal areas and the text area. */)
6066DEFUN ("window-fringes", Fwindow_fringes, Swindow_fringes, 6069DEFUN ("window-fringes", Fwindow_fringes, Swindow_fringes,
6067 0, 1, 0, 6070 0, 1, 0,
6068 doc: /* Get width of fringes of window WINDOW. 6071 doc: /* Get width of fringes of window WINDOW.
6069If WINDOW is omitted or nil, use the currently selected window. 6072If WINDOW is omitted or nil, it defaults to the selected window.
6070Value is a list of the form (LEFT-WIDTH RIGHT-WIDTH OUTSIDE-MARGINS). */) 6073Value is a list of the form (LEFT-WIDTH RIGHT-WIDTH OUTSIDE-MARGINS). */)
6071 (Lisp_Object window) 6074 (Lisp_Object window)
6072{ 6075{
@@ -6135,7 +6138,7 @@ Fourth parameter HORIZONTAL-TYPE is currently unused. */)
6135DEFUN ("window-scroll-bars", Fwindow_scroll_bars, Swindow_scroll_bars, 6138DEFUN ("window-scroll-bars", Fwindow_scroll_bars, Swindow_scroll_bars,
6136 0, 1, 0, 6139 0, 1, 0,
6137 doc: /* Get width and type of scroll bars of window WINDOW. 6140 doc: /* Get width and type of scroll bars of window WINDOW.
6138If WINDOW is omitted or nil, use the currently selected window. 6141If WINDOW is omitted or nil, it defaults to the selected window.
6139Value is a list of the form (WIDTH COLS VERTICAL-TYPE HORIZONTAL-TYPE). 6142Value is a list of the form (WIDTH COLS VERTICAL-TYPE HORIZONTAL-TYPE).
6140If WIDTH is nil or TYPE is t, the window is using the frame's corresponding 6143If WIDTH is nil or TYPE is t, the window is using the frame's corresponding
6141value. */) 6144value. */)
@@ -6158,7 +6161,7 @@ value. */)
6158 6161
6159DEFUN ("window-vscroll", Fwindow_vscroll, Swindow_vscroll, 0, 2, 0, 6162DEFUN ("window-vscroll", Fwindow_vscroll, Swindow_vscroll, 0, 2, 0,
6160 doc: /* Return the amount by which WINDOW is scrolled vertically. 6163 doc: /* Return the amount by which WINDOW is scrolled vertically.
6161Use the selected window if WINDOW is nil or omitted. 6164If WINDOW is omitted or nil, it defaults to the selected window.
6162Normally, value is a multiple of the canonical character height of WINDOW; 6165Normally, value is a multiple of the canonical character height of WINDOW;
6163optional second arg PIXELS-P means value is measured in pixels. */) 6166optional second arg PIXELS-P means value is measured in pixels. */)
6164 (Lisp_Object window, Lisp_Object pixels_p) 6167 (Lisp_Object window, Lisp_Object pixels_p)