diff options
| -rw-r--r-- | doc/lispref/ChangeLog | 6 | ||||
| -rw-r--r-- | doc/lispref/windows.texi | 16 | ||||
| -rw-r--r-- | lisp/ChangeLog | 21 | ||||
| -rw-r--r-- | lisp/files.el | 2 | ||||
| -rw-r--r-- | lisp/window.el | 185 | ||||
| -rw-r--r-- | src/ChangeLog | 13 | ||||
| -rw-r--r-- | src/frame.c | 2 | ||||
| -rw-r--r-- | src/window.c | 76 | ||||
| -rw-r--r-- | src/window.h | 2 |
9 files changed, 183 insertions, 140 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index 1a692c6b36d..d714d1b26e5 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2011-11-07 Martin Rudalics <rudalics@gmx.at> | ||
| 2 | |||
| 3 | * windows.texi (Resizing Windows, Splitting Windows) | ||
| 4 | (Window Configurations): Use "child window" instead of | ||
| 5 | "subwindow". | ||
| 6 | |||
| 1 | 2011-11-06 Chong Yidong <cyd@gnu.org> | 7 | 2011-11-06 Chong Yidong <cyd@gnu.org> |
| 2 | 8 | ||
| 3 | * windows.texi (Basic Windows): Clarify various definitions. | 9 | * windows.texi (Basic Windows): Clarify various definitions. |
diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi index 8b466e02214..eb3c1849523 100644 --- a/doc/lispref/windows.texi +++ b/doc/lispref/windows.texi | |||
| @@ -719,7 +719,7 @@ Optional argument @var{noup} non-@code{nil} means don't go up in the | |||
| 719 | window tree but try to steal or distribute the space needed for the | 719 | window tree but try to steal or distribute the space needed for the |
| 720 | resize operation among the other windows within @var{window}'s | 720 | resize operation among the other windows within @var{window}'s |
| 721 | combination. Optional argument @var{nodown} non-@code{nil} means don't | 721 | combination. Optional argument @var{nodown} non-@code{nil} means don't |
| 722 | check whether @var{window} itself and its subwindows can be resized. | 722 | check whether @var{window} itself and its child windows can be resized. |
| 723 | @end defun | 723 | @end defun |
| 724 | 724 | ||
| 725 | The function @code{window-resizable} does not change any window sizes. | 725 | The function @code{window-resizable} does not change any window sizes. |
| @@ -1352,15 +1352,15 @@ windows only. | |||
| 1352 | 1352 | ||
| 1353 | @cindex nest status | 1353 | @cindex nest status |
| 1354 | The @dfn{nest status} of a window specifies whether that window may be | 1354 | The @dfn{nest status} of a window specifies whether that window may be |
| 1355 | removed and its subwindows recombined with that window's siblings when | 1355 | removed and its child windows recombined with that window's siblings |
| 1356 | such a sibling's subwindow is deleted. The nest status is initially | 1356 | when such a sibling's child window is deleted. The nest status is |
| 1357 | assigned by @code{split-window} from the current value of the variable | 1357 | initially assigned by @code{split-window} from the current value of the |
| 1358 | @code{window-nest} (see above) and can be reset by the function | 1358 | variable @code{window-nest} (see above) and can be reset by the function |
| 1359 | @code{set-window-nest} (see below). | 1359 | @code{set-window-nest} (see below). |
| 1360 | 1360 | ||
| 1361 | If the return value is @code{nil}, subwindows of @var{window} may be | 1361 | If the return value is @code{nil}, child windows of @var{window} may be |
| 1362 | recombined with @var{window}'s siblings when a window gets deleted. A | 1362 | recombined with @var{window}'s siblings when a window gets deleted. A |
| 1363 | return value of @code{nil} means that subwindows of @var{window} are | 1363 | return value of @code{nil} means that child windows of @var{window} are |
| 1364 | never (re-)combined with @var{window}'s siblings in such a case. | 1364 | never (re-)combined with @var{window}'s siblings in such a case. |
| 1365 | @end defun | 1365 | @end defun |
| 1366 | 1366 | ||
| @@ -3740,7 +3740,7 @@ selected one. | |||
| 3740 | 3740 | ||
| 3741 | The optional argument @var{ignore} non-@code{nil} means to ignore | 3741 | The optional argument @var{ignore} non-@code{nil} means to ignore |
| 3742 | minimum window sizes and fixed size restrictions. If @var{ignore} | 3742 | minimum window sizes and fixed size restrictions. If @var{ignore} |
| 3743 | equals @code{safe}, this means subwindows can get as small as one line | 3743 | equals @code{safe}, this means windows can get as small as one line |
| 3744 | and/or two columns. | 3744 | and/or two columns. |
| 3745 | @end defun | 3745 | @end defun |
| 3746 | 3746 | ||
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e0716bea83f..ff61568a8f2 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,24 @@ | |||
| 1 | 2011-11-07 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * files.el (find-file): Always use selected-window. | ||
| 4 | |||
| 5 | 2011-11-07 Martin Rudalics <rudalics@gmx.at> | ||
| 6 | |||
| 7 | * window.el (window-combinations): Make WINDOW argument | ||
| 8 | mandatory. Rewrite doc-string. | ||
| 9 | (walk-window-subtree, window-atom-check, window-min-delta) | ||
| 10 | (window-max-delta, window--resize-this-window) | ||
| 11 | (window--resize-root-window-vertically, window-tree) | ||
| 12 | (balance-windows, window-state-put): Rewrite doc-strings as to | ||
| 13 | not mention the term "subwindow". | ||
| 14 | (window--resize-subwindows-skip-p): Rename to | ||
| 15 | window--resize-child-windows-skip-p. | ||
| 16 | (window--resize-subwindows-normal): Rename to | ||
| 17 | window--resize-child-windows-normal. | ||
| 18 | (window--resize-subwindows): Rename to | ||
| 19 | window--resize-child-windows. | ||
| 20 | (window-or-subwindow-p): Rename to window--in-subtree-p. | ||
| 21 | |||
| 1 | 2011-11-07 Mark Lillibridge <mark.lillibridge@hp.com> (tiny change) | 22 | 2011-11-07 Mark Lillibridge <mark.lillibridge@hp.com> (tiny change) |
| 2 | 23 | ||
| 3 | * mail/rmail.el (rmail-get-new-mail, rmail-insert-inbox-text): | 24 | * mail/rmail.el (rmail-get-new-mail, rmail-insert-inbox-text): |
diff --git a/lisp/files.el b/lisp/files.el index 40e2df14c1b..acff3395019 100644 --- a/lisp/files.el +++ b/lisp/files.el | |||
| @@ -1343,7 +1343,7 @@ automatically choosing a major mode, use \\[find-file-literally]." | |||
| 1343 | (let ((value (find-file-noselect filename nil nil wildcards))) | 1343 | (let ((value (find-file-noselect filename nil nil wildcards))) |
| 1344 | (if (listp value) | 1344 | (if (listp value) |
| 1345 | (mapcar 'switch-to-buffer (nreverse value)) | 1345 | (mapcar 'switch-to-buffer (nreverse value)) |
| 1346 | (switch-to-buffer value)))) | 1346 | (switch-to-buffer value nil 'force-same-window)))) |
| 1347 | 1347 | ||
| 1348 | (defun find-file-other-window (filename &optional wildcards) | 1348 | (defun find-file-other-window (filename &optional wildcards) |
| 1349 | "Edit file FILENAME, in another window. | 1349 | "Edit file FILENAME, in another window. |
diff --git a/lisp/window.el b/lisp/window.el index 1b51bde36bd..2f4988b8b39 100644 --- a/lisp/window.el +++ b/lisp/window.el | |||
| @@ -211,11 +211,11 @@ horizontal window combination." | |||
| 211 | (window-left-child parent) | 211 | (window-left-child parent) |
| 212 | (window-top-child parent))))) | 212 | (window-top-child parent))))) |
| 213 | 213 | ||
| 214 | (defun window-combinations (&optional window horizontal) | 214 | (defun window-combinations (window &optional horizontal) |
| 215 | "Return largest number of vertically arranged subwindows of WINDOW. | 215 | "Return largest number of windows vertically arranged within WINDOW. |
| 216 | If WINDOW is omitted or nil, it defaults to the selected window. | 216 | If WINDOW is omitted or nil, it defaults to the selected window. |
| 217 | If HORIZONTAL is non-nil, return the largest number of | 217 | If HORIZONTAL is non-nil, return the largest number of |
| 218 | horizontally arranged subwindows of WINDOW." | 218 | windows horizontally arranged within WINDOW." |
| 219 | (setq window (window-normalize-window window)) | 219 | (setq window (window-normalize-window window)) |
| 220 | (cond | 220 | (cond |
| 221 | ((window-live-p window) | 221 | ((window-live-p window) |
| @@ -225,7 +225,7 @@ horizontally arranged subwindows of WINDOW." | |||
| 225 | (window-left-child window) | 225 | (window-left-child window) |
| 226 | (window-top-child window)) | 226 | (window-top-child window)) |
| 227 | ;; If WINDOW is iso-combined, return the sum of the values for all | 227 | ;; If WINDOW is iso-combined, return the sum of the values for all |
| 228 | ;; subwindows of WINDOW. | 228 | ;; child windows of WINDOW. |
| 229 | (let ((child (window-child window)) | 229 | (let ((child (window-child window)) |
| 230 | (count 0)) | 230 | (count 0)) |
| 231 | (while child | 231 | (while child |
| @@ -236,7 +236,7 @@ horizontally arranged subwindows of WINDOW." | |||
| 236 | count)) | 236 | count)) |
| 237 | (t | 237 | (t |
| 238 | ;; If WINDOW is not iso-combined, return the maximum value of any | 238 | ;; If WINDOW is not iso-combined, return the maximum value of any |
| 239 | ;; subwindow of WINDOW. | 239 | ;; child window of WINDOW. |
| 240 | (let ((child (window-child window)) | 240 | (let ((child (window-child window)) |
| 241 | (count 1)) | 241 | (count 1)) |
| 242 | (while child | 242 | (while child |
| @@ -279,14 +279,16 @@ unpredictable." | |||
| 279 | proc (frame-root-window walk-window-tree-frame) any))) | 279 | proc (frame-root-window walk-window-tree-frame) any))) |
| 280 | 280 | ||
| 281 | (defun walk-window-subtree (proc &optional window any) | 281 | (defun walk-window-subtree (proc &optional window any) |
| 282 | "Run function PROC on each live subwindow of WINDOW. | 282 | "Run function PROC on the subtree of windows rooted at WINDOW. |
| 283 | WINDOW defaults to the selected window. PROC must be a function | 283 | WINDOW defaults to the selected window. PROC must be a function |
| 284 | with one argument - a window. ANY, if non-nil means to run PROC | 284 | with one argument - a window. By default, run PROC only on live |
| 285 | on all live and internal subwindows of WINDOW. | 285 | windows of the subtree. If the optional argument ANY is non-nil, |
| 286 | run PROC on all live and internal windows of the subtree. If | ||
| 287 | WINDOW is live, run PROC on WINDOW only. | ||
| 286 | 288 | ||
| 287 | This function performs a pre-order, depth-first traversal of the | 289 | This function performs a pre-order, depth-first traversal of the |
| 288 | window tree rooted at WINDOW. If PROC changes that window tree, | 290 | subtree rooted at WINDOW. If PROC changes that tree, the result |
| 289 | the result is unpredictable." | 291 | is unpredictable." |
| 290 | (setq window (window-normalize-window window)) | 292 | (setq window (window-normalize-window window)) |
| 291 | (walk-window-tree-1 proc window any t)) | 293 | (walk-window-tree-1 proc window any t)) |
| 292 | 294 | ||
| @@ -381,9 +383,9 @@ WINDOW must be an internal window. Return WINDOW." | |||
| 381 | (defun window-atom-check (&optional frame) | 383 | (defun window-atom-check (&optional frame) |
| 382 | "Check atomicity of all windows on FRAME. | 384 | "Check atomicity of all windows on FRAME. |
| 383 | FRAME defaults to the selected frame. If an atomic window is | 385 | FRAME defaults to the selected frame. If an atomic window is |
| 384 | wrongly configured, reset the atomicity of all its subwindows to | 386 | wrongly configured, reset the atomicity of all its windows on |
| 385 | nil. An atomic window is wrongly configured if it has no | 387 | FRAME to nil. An atomic window is wrongly configured if it has |
| 386 | subwindows or one of its subwindows is not atomic." | 388 | no child windows or one of its child windows is not atomic." |
| 387 | (window-atom-check-1 (frame-root-window frame))) | 389 | (window-atom-check-1 (frame-root-window frame))) |
| 388 | 390 | ||
| 389 | ;; Side windows. | 391 | ;; Side windows. |
| @@ -555,13 +557,13 @@ restrictions for that window only." | |||
| 555 | ;; WINDOW is an internal window. | 557 | ;; WINDOW is an internal window. |
| 556 | (if (window-combined-p sub horizontal) | 558 | (if (window-combined-p sub horizontal) |
| 557 | ;; The minimum size of an iso-combination is the sum of | 559 | ;; The minimum size of an iso-combination is the sum of |
| 558 | ;; the minimum sizes of its subwindows. | 560 | ;; the minimum sizes of its child windows. |
| 559 | (while sub | 561 | (while sub |
| 560 | (setq value (+ value | 562 | (setq value (+ value |
| 561 | (window-min-size-1 sub horizontal ignore))) | 563 | (window-min-size-1 sub horizontal ignore))) |
| 562 | (setq sub (window-right sub))) | 564 | (setq sub (window-right sub))) |
| 563 | ;; The minimum size of an ortho-combination is the maximum of | 565 | ;; The minimum size of an ortho-combination is the maximum of |
| 564 | ;; the minimum sizes of its subwindows. | 566 | ;; the minimum sizes of its child windows. |
| 565 | (while sub | 567 | (while sub |
| 566 | (setq value (max value | 568 | (setq value (max value |
| 567 | (window-min-size-1 sub horizontal ignore))) | 569 | (window-min-size-1 sub horizontal ignore))) |
| @@ -619,8 +621,9 @@ Optional argument HORIZONTAL non-nil means return DELTA if DELTA | |||
| 619 | columns can be added to WINDOW. A return value of zero means | 621 | columns can be added to WINDOW. A return value of zero means |
| 620 | that no lines (or columns) can be added to WINDOW. | 622 | that no lines (or columns) can be added to WINDOW. |
| 621 | 623 | ||
| 622 | This function looks only at WINDOW and its subwindows. The | 624 | This function looks only at WINDOW and, recursively, its child |
| 623 | function `window-resizable' looks at other windows as well. | 625 | windows. The function `window-resizable' looks at other windows |
| 626 | as well. | ||
| 624 | 627 | ||
| 625 | DELTA positive means WINDOW shall be enlarged by DELTA lines or | 628 | DELTA positive means WINDOW shall be enlarged by DELTA lines or |
| 626 | columns. If WINDOW cannot be enlarged by DELTA lines or columns | 629 | columns. If WINDOW cannot be enlarged by DELTA lines or columns |
| @@ -668,24 +671,24 @@ doc-string of `window-sizable'." | |||
| 668 | (if sub | 671 | (if sub |
| 669 | ;; WINDOW is an internal window. | 672 | ;; WINDOW is an internal window. |
| 670 | (if (window-combined-p sub horizontal) | 673 | (if (window-combined-p sub horizontal) |
| 671 | ;; An iso-combination is fixed size if all its subwindows | 674 | ;; An iso-combination is fixed size if all its child |
| 672 | ;; are fixed-size. | 675 | ;; windows are fixed-size. |
| 673 | (progn | 676 | (progn |
| 674 | (while sub | 677 | (while sub |
| 675 | (unless (window-size-fixed-1 sub horizontal) | 678 | (unless (window-size-fixed-1 sub horizontal) |
| 676 | ;; We found a non-fixed-size subwindow, so WINDOW's | 679 | ;; We found a non-fixed-size child window, so |
| 677 | ;; size is not fixed. | 680 | ;; WINDOW's size is not fixed. |
| 678 | (throw 'fixed nil)) | 681 | (throw 'fixed nil)) |
| 679 | (setq sub (window-right sub))) | 682 | (setq sub (window-right sub))) |
| 680 | ;; All subwindows are fixed-size, so WINDOW's size is | 683 | ;; All child windows are fixed-size, so WINDOW's size is |
| 681 | ;; fixed. | 684 | ;; fixed. |
| 682 | (throw 'fixed t)) | 685 | (throw 'fixed t)) |
| 683 | ;; An ortho-combination is fixed-size if at least one of its | 686 | ;; An ortho-combination is fixed-size if at least one of its |
| 684 | ;; subwindows is fixed-size. | 687 | ;; child windows is fixed-size. |
| 685 | (while sub | 688 | (while sub |
| 686 | (when (window-size-fixed-1 sub horizontal) | 689 | (when (window-size-fixed-1 sub horizontal) |
| 687 | ;; We found a fixed-size subwindow, so WINDOW's size is | 690 | ;; We found a fixed-size child window, so WINDOW's size |
| 688 | ;; fixed. | 691 | ;; is fixed. |
| 689 | (throw 'fixed t)) | 692 | (throw 'fixed t)) |
| 690 | (setq sub (window-right sub)))) | 693 | (setq sub (window-right sub)))) |
| 691 | ;; WINDOW is a live window. | 694 | ;; WINDOW is a live window. |
| @@ -717,8 +720,8 @@ WINDOW can be resized in the desired direction. The functions | |||
| 717 | (catch 'done | 720 | (catch 'done |
| 718 | (if (window-combined-p sub horizontal) | 721 | (if (window-combined-p sub horizontal) |
| 719 | ;; In an iso-combination throw DELTA if we find at least one | 722 | ;; In an iso-combination throw DELTA if we find at least one |
| 720 | ;; subwindow and that subwindow is either not of fixed-size | 723 | ;; child window and that window is either not fixed-size or |
| 721 | ;; or we can ignore fixed-sizeness. | 724 | ;; we can ignore fixed-sizeness. |
| 722 | (let ((skip (eq trail 'after))) | 725 | (let ((skip (eq trail 'after))) |
| 723 | (while sub | 726 | (while sub |
| 724 | (cond | 727 | (cond |
| @@ -728,11 +731,11 @@ WINDOW can be resized in the desired direction. The functions | |||
| 728 | ((and (not (window-size-ignore window ignore)) | 731 | ((and (not (window-size-ignore window ignore)) |
| 729 | (window-size-fixed-p sub horizontal))) | 732 | (window-size-fixed-p sub horizontal))) |
| 730 | (t | 733 | (t |
| 731 | ;; We found a non-fixed-size subwindow. | 734 | ;; We found a non-fixed-size child window. |
| 732 | (throw 'done delta))) | 735 | (throw 'done delta))) |
| 733 | (setq sub (window-right sub)))) | 736 | (setq sub (window-right sub)))) |
| 734 | ;; In an ortho-combination set DELTA to the minimum value by | 737 | ;; In an ortho-combination set DELTA to the minimum value by |
| 735 | ;; which other subwindows can shrink. | 738 | ;; which other child windows can shrink. |
| 736 | (while sub | 739 | (while sub |
| 737 | (unless (eq sub window) | 740 | (unless (eq sub window) |
| 738 | (setq delta | 741 | (setq delta |
| @@ -768,8 +771,8 @@ Optional argument NOUP non-nil means don't go up in the window | |||
| 768 | tree but try to enlarge windows within WINDOW's combination only. | 771 | tree but try to enlarge windows within WINDOW's combination only. |
| 769 | 772 | ||
| 770 | Optional argument NODOWN non-nil means don't check whether WINDOW | 773 | Optional argument NODOWN non-nil means don't check whether WINDOW |
| 771 | itself \(and its subwindows) can be shrunk; check only whether at | 774 | itself \(and its child windows) can be shrunk; check only whether |
| 772 | least one other windows can be enlarged appropriately." | 775 | at least one other windows can be enlarged appropriately." |
| 773 | (setq window (window-normalize-window window)) | 776 | (setq window (window-normalize-window window)) |
| 774 | (let ((size (window-total-size window horizontal)) | 777 | (let ((size (window-total-size window horizontal)) |
| 775 | (minimum (window-min-size window horizontal ignore))) | 778 | (minimum (window-min-size window horizontal ignore))) |
| @@ -797,7 +800,7 @@ least one other windows can be enlarged appropriately." | |||
| 797 | (catch 'fixed | 800 | (catch 'fixed |
| 798 | (if (window-combined-p sub horizontal) | 801 | (if (window-combined-p sub horizontal) |
| 799 | ;; For an iso-combination calculate how much we can get from | 802 | ;; For an iso-combination calculate how much we can get from |
| 800 | ;; other subwindows. | 803 | ;; other child windows. |
| 801 | (let ((skip (eq trail 'after))) | 804 | (let ((skip (eq trail 'after))) |
| 802 | (while sub | 805 | (while sub |
| 803 | (cond | 806 | (cond |
| @@ -811,7 +814,7 @@ least one other windows can be enlarged appropriately." | |||
| 811 | (window-min-size sub horizontal ignore)))))) | 814 | (window-min-size sub horizontal ignore)))))) |
| 812 | (setq sub (window-right sub)))) | 815 | (setq sub (window-right sub)))) |
| 813 | ;; For an ortho-combination throw DELTA when at least one | 816 | ;; For an ortho-combination throw DELTA when at least one |
| 814 | ;; subwindow is fixed-size. | 817 | ;; child window is fixed-size. |
| 815 | (while sub | 818 | (while sub |
| 816 | (when (and (not (eq sub window)) | 819 | (when (and (not (eq sub window)) |
| 817 | (not (window-size-ignore sub ignore)) | 820 | (not (window-size-ignore sub ignore)) |
| @@ -850,8 +853,8 @@ tree but try to obtain the entire space from windows within | |||
| 850 | WINDOW's combination. | 853 | WINDOW's combination. |
| 851 | 854 | ||
| 852 | Optional argument NODOWN non-nil means do not check whether | 855 | Optional argument NODOWN non-nil means do not check whether |
| 853 | WINDOW itself \(and its subwindows) can be enlarged; check only | 856 | WINDOW itself \(and its child windows) can be enlarged; check |
| 854 | whether other windows can be shrunk appropriately." | 857 | only whether other windows can be shrunk appropriately." |
| 855 | (setq window (window-normalize-window window)) | 858 | (setq window (window-normalize-window window)) |
| 856 | (if (and (not (window-size-ignore window ignore)) | 859 | (if (and (not (window-size-ignore window ignore)) |
| 857 | (not nodown) (window-size-fixed-p window horizontal)) | 860 | (not nodown) (window-size-fixed-p window horizontal)) |
| @@ -895,7 +898,7 @@ tree but try to distribute the space among the other windows | |||
| 895 | within WINDOW's combination. | 898 | within WINDOW's combination. |
| 896 | 899 | ||
| 897 | Optional argument NODOWN non-nil means don't check whether WINDOW | 900 | Optional argument NODOWN non-nil means don't check whether WINDOW |
| 898 | and its subwindows can be resized." | 901 | and its child windows can be resized." |
| 899 | (setq window (window-normalize-window window)) | 902 | (setq window (window-normalize-window window)) |
| 900 | (cond | 903 | (cond |
| 901 | ((< delta 0) | 904 | ((< delta 0) |
| @@ -1463,9 +1466,9 @@ as small) as possible but don't signal an error." | |||
| 1463 | 1466 | ||
| 1464 | ;; Resize now. | 1467 | ;; Resize now. |
| 1465 | (window--resize-reset frame) | 1468 | (window--resize-reset frame) |
| 1466 | ;; Ideally we should be able to resize just the last subwindow of | 1469 | ;; Ideally we should be able to resize just the last child of root |
| 1467 | ;; root here. See the comment in `resize-root-window-vertically' | 1470 | ;; here. See the comment in `resize-root-window-vertically' for |
| 1468 | ;; for why we do not do that. | 1471 | ;; why we do not do that. |
| 1469 | (window--resize-this-window root (- delta) nil nil t) | 1472 | (window--resize-this-window root (- delta) nil nil t) |
| 1470 | (set-window-new-total window (+ height delta)) | 1473 | (set-window-new-total window (+ height delta)) |
| 1471 | ;; The following routine catches the case where we want to resize | 1474 | ;; The following routine catches the case where we want to resize |
| @@ -1532,14 +1535,14 @@ instead." | |||
| 1532 | (t | 1535 | (t |
| 1533 | (error "Cannot resize window %s" window))))) | 1536 | (error "Cannot resize window %s" window))))) |
| 1534 | 1537 | ||
| 1535 | (defsubst window--resize-subwindows-skip-p (window) | 1538 | (defsubst window--resize-child-windows-skip-p (window) |
| 1536 | "Return non-nil if WINDOW shall be skipped by resizing routines." | 1539 | "Return non-nil if WINDOW shall be skipped by resizing routines." |
| 1537 | (memq (window-new-normal window) '(ignore stuck skip))) | 1540 | (memq (window-new-normal window) '(ignore stuck skip))) |
| 1538 | 1541 | ||
| 1539 | (defun window--resize-subwindows-normal (parent horizontal window this-delta &optional trail other-delta) | 1542 | (defun window--resize-child-windows-normal (parent horizontal window this-delta &optional trail other-delta) |
| 1540 | "Set the new normal height of subwindows of window PARENT. | 1543 | "Recursively set new normal height of child windows of window PARENT. |
| 1541 | HORIZONTAL non-nil means set the new normal width of these | 1544 | HORIZONTAL non-nil means set the new normal width of these |
| 1542 | windows. WINDOW specifies a subwindow of PARENT that has been | 1545 | windows. WINDOW specifies a child window of PARENT that has been |
| 1543 | resized by THIS-DELTA lines \(columns). | 1546 | resized by THIS-DELTA lines \(columns). |
| 1544 | 1547 | ||
| 1545 | Optional argument TRAIL either 'before or 'after means set values | 1548 | Optional argument TRAIL either 'before or 'after means set values |
| @@ -1561,8 +1564,8 @@ PARENT in order to resize WINDOW." | |||
| 1561 | (parent-normal 0.0) | 1564 | (parent-normal 0.0) |
| 1562 | (skip (eq trail 'after))) | 1565 | (skip (eq trail 'after))) |
| 1563 | 1566 | ||
| 1564 | ;; Set parent-normal to the sum of the normal sizes of all | 1567 | ;; Set parent-normal to the sum of the normal sizes of all child |
| 1565 | ;; subwindows of PARENT that shall be resized, excluding only WINDOW | 1568 | ;; windows of PARENT that shall be resized, excluding only WINDOW |
| 1566 | ;; and any windows specified by the optional TRAIL argument. | 1569 | ;; and any windows specified by the optional TRAIL argument. |
| 1567 | (while sub | 1570 | (while sub |
| 1568 | (cond | 1571 | (cond |
| @@ -1574,7 +1577,7 @@ PARENT in order to resize WINDOW." | |||
| 1574 | (+ parent-normal (window-normal-size sub horizontal))))) | 1577 | (+ parent-normal (window-normal-size sub horizontal))))) |
| 1575 | (setq sub (window-right sub))) | 1578 | (setq sub (window-right sub))) |
| 1576 | 1579 | ||
| 1577 | ;; Set the new normal size of all subwindows of PARENT from what | 1580 | ;; Set the new normal size of all child windows of PARENT from what |
| 1578 | ;; they should have contributed for recovering THIS-DELTA lines | 1581 | ;; they should have contributed for recovering THIS-DELTA lines |
| 1579 | ;; (columns). | 1582 | ;; (columns). |
| 1580 | (setq sub (window-child parent)) | 1583 | (setq sub (window-child parent)) |
| @@ -1633,11 +1636,11 @@ PARENT in order to resize WINDOW." | |||
| 1633 | ;; Don't get larger than 1 or smaller than 0. | 1636 | ;; Don't get larger than 1 or smaller than 0. |
| 1634 | (min 1.0 (max (- 1.0 sum) 0.0)))))) | 1637 | (min 1.0 (max (- 1.0 sum) 0.0)))))) |
| 1635 | 1638 | ||
| 1636 | (defun window--resize-subwindows (parent delta &optional horizontal window ignore trail edge) | 1639 | (defun window--resize-child-windows (parent delta &optional horizontal window ignore trail edge) |
| 1637 | "Resize subwindows of window PARENT vertically by DELTA lines. | 1640 | "Resize child windows of window PARENT vertically by DELTA lines. |
| 1638 | PARENT must be a vertically combined internal window. | 1641 | PARENT must be a vertically combined internal window. |
| 1639 | 1642 | ||
| 1640 | Optional argument HORIZONTAL non-nil means resize subwindows of | 1643 | Optional argument HORIZONTAL non-nil means resize child windows of |
| 1641 | PARENT horizontally by DELTA columns. In this case PARENT must | 1644 | PARENT horizontally by DELTA columns. In this case PARENT must |
| 1642 | be a horizontally combined internal window. | 1645 | be a horizontally combined internal window. |
| 1643 | 1646 | ||
| @@ -1669,10 +1672,10 @@ already set by this routine." | |||
| 1669 | (setq sub first) | 1672 | (setq sub first) |
| 1670 | (while (and (window-right sub) | 1673 | (while (and (window-right sub) |
| 1671 | (or (and (eq trail 'before) | 1674 | (or (and (eq trail 'before) |
| 1672 | (not (window--resize-subwindows-skip-p | 1675 | (not (window--resize-child-windows-skip-p |
| 1673 | (window-right sub)))) | 1676 | (window-right sub)))) |
| 1674 | (and (eq trail 'after) | 1677 | (and (eq trail 'after) |
| 1675 | (window--resize-subwindows-skip-p sub)))) | 1678 | (window--resize-child-windows-skip-p sub)))) |
| 1676 | (setq sub (window-right sub))) | 1679 | (setq sub (window-right sub))) |
| 1677 | sub) | 1680 | sub) |
| 1678 | (if horizontal | 1681 | (if horizontal |
| @@ -1700,7 +1703,7 @@ already set by this routine." | |||
| 1700 | window (- (window-normal-size window horizontal) | 1703 | window (- (window-normal-size window horizontal) |
| 1701 | (- (window-new-normal sub) | 1704 | (- (window-new-normal sub) |
| 1702 | (window-normal-size sub horizontal))))) | 1705 | (window-normal-size sub horizontal))))) |
| 1703 | (window--resize-subwindows-normal | 1706 | (window--resize-child-windows-normal |
| 1704 | parent horizontal sub 0 trail delta)) | 1707 | parent horizontal sub 0 trail delta)) |
| 1705 | ;; Return 'normalized to notify `window--resize-siblings' that | 1708 | ;; Return 'normalized to notify `window--resize-siblings' that |
| 1706 | ;; normal sizes have been already set. | 1709 | ;; normal sizes have been already set. |
| @@ -1709,9 +1712,9 @@ already set by this routine." | |||
| 1709 | (setq sub first) | 1712 | (setq sub first) |
| 1710 | (while sub | 1713 | (while sub |
| 1711 | (cond | 1714 | (cond |
| 1712 | ((or (window--resize-subwindows-skip-p sub) | 1715 | ((or (window--resize-child-windows-skip-p sub) |
| 1713 | ;; Ignore windows to skip and fixed-size subwindows - in | 1716 | ;; Ignore windows to skip and fixed-size child windows - |
| 1714 | ;; the latter case make it a window to skip. | 1717 | ;; in the latter case make it a window to skip. |
| 1715 | (and (not ignore) | 1718 | (and (not ignore) |
| 1716 | (window-size-fixed-p sub horizontal) | 1719 | (window-size-fixed-p sub horizontal) |
| 1717 | (set-window-new-normal sub 'ignore)))) | 1720 | (set-window-new-normal sub 'ignore)))) |
| @@ -1799,7 +1802,7 @@ already set by this routine." | |||
| 1799 | (set-window-new-normal sub)) | 1802 | (set-window-new-normal sub)) |
| 1800 | 1803 | ||
| 1801 | (unless (eq (window-new-normal sub) 'ignore) | 1804 | (unless (eq (window-new-normal sub) 'ignore) |
| 1802 | ;; Resize this subwindow's subwindows (back-engineering | 1805 | ;; Resize this window's child windows (back-engineering |
| 1803 | ;; delta from sub's old and new total sizes). | 1806 | ;; delta from sub's old and new total sizes). |
| 1804 | (let ((delta (- (window-new-total sub) | 1807 | (let ((delta (- (window-new-total sub) |
| 1805 | (window-total-size sub horizontal)))) | 1808 | (window-total-size sub horizontal)))) |
| @@ -1882,19 +1885,19 @@ preferably only resize windows adjacent to EDGE." | |||
| 1882 | (if (zerop this-delta) | 1885 | (if (zerop this-delta) |
| 1883 | ;; We haven't got anything from WINDOW's siblings but we | 1886 | ;; We haven't got anything from WINDOW's siblings but we |
| 1884 | ;; must update the normal sizes to respect other-delta. | 1887 | ;; must update the normal sizes to respect other-delta. |
| 1885 | (window--resize-subwindows-normal | 1888 | (window--resize-child-windows-normal |
| 1886 | parent horizontal window this-delta trail other-delta) | 1889 | parent horizontal window this-delta trail other-delta) |
| 1887 | ;; We did get something from WINDOW's siblings which means | 1890 | ;; We did get something from WINDOW's siblings which means |
| 1888 | ;; we have to resize their subwindows. | 1891 | ;; we have to resize their child windows. |
| 1889 | (unless (eq (window--resize-subwindows | 1892 | (unless (eq (window--resize-child-windows |
| 1890 | parent (- this-delta) horizontal | 1893 | parent (- this-delta) horizontal |
| 1891 | window ignore trail edge) | 1894 | window ignore trail edge) |
| 1892 | ;; If `window--resize-subwindows' returns | 1895 | ;; If `window--resize-child-windows' returns |
| 1893 | ;; 'normalized, this means it has set the | 1896 | ;; 'normalized, this means it has set the |
| 1894 | ;; normal sizes already. | 1897 | ;; normal sizes already. |
| 1895 | 'normalized) | 1898 | 'normalized) |
| 1896 | ;; Set the normal sizes. | 1899 | ;; Set the normal sizes. |
| 1897 | (window--resize-subwindows-normal | 1900 | (window--resize-child-windows-normal |
| 1898 | parent horizontal window this-delta trail other-delta)) | 1901 | parent horizontal window this-delta trail other-delta)) |
| 1899 | ;; Set DELTA to what we still have to get from ancestor | 1902 | ;; Set DELTA to what we still have to get from ancestor |
| 1900 | ;; windows. | 1903 | ;; windows. |
| @@ -1934,7 +1937,7 @@ resize only windows on the left or above EDGE. If TRAIL equals | |||
| 1934 | `after', resize only windows on the right or below EDGE. Also, | 1937 | `after', resize only windows on the right or below EDGE. Also, |
| 1935 | preferably only resize windows adjacent to EDGE. | 1938 | preferably only resize windows adjacent to EDGE. |
| 1936 | 1939 | ||
| 1937 | This function recursively resizes WINDOW's subwindows to fit the | 1940 | This function recursively resizes WINDOW's child windows to fit the |
| 1938 | new size. Make sure that WINDOW is `window-resizable' before | 1941 | new size. Make sure that WINDOW is `window-resizable' before |
| 1939 | calling this function. Note that this function does not resize | 1942 | calling this function. Note that this function does not resize |
| 1940 | siblings of WINDOW or WINDOW's parent window. You have to | 1943 | siblings of WINDOW or WINDOW's parent window. You have to |
| @@ -1948,11 +1951,11 @@ actually take effect." | |||
| 1948 | (cond | 1951 | (cond |
| 1949 | ((not sub)) | 1952 | ((not sub)) |
| 1950 | ((window-combined-p sub horizontal) | 1953 | ((window-combined-p sub horizontal) |
| 1951 | ;; In an iso-combination resize subwindows according to their | 1954 | ;; In an iso-combination resize child windows according to their |
| 1952 | ;; normal sizes. | 1955 | ;; normal sizes. |
| 1953 | (window--resize-subwindows | 1956 | (window--resize-child-windows |
| 1954 | window delta horizontal nil ignore trail edge)) | 1957 | window delta horizontal nil ignore trail edge)) |
| 1955 | ;; In an ortho-combination resize each subwindow by DELTA. | 1958 | ;; In an ortho-combination resize each child window by DELTA. |
| 1956 | (t | 1959 | (t |
| 1957 | (while sub | 1960 | (while sub |
| 1958 | (window--resize-this-window | 1961 | (window--resize-this-window |
| @@ -1978,7 +1981,7 @@ resizes windows proportionally and never deletes any windows." | |||
| 1978 | "Resize root window WINDOW vertically by DELTA lines. | 1981 | "Resize root window WINDOW vertically by DELTA lines. |
| 1979 | If DELTA is less than zero and we can't shrink WINDOW by DELTA | 1982 | If DELTA is less than zero and we can't shrink WINDOW by DELTA |
| 1980 | lines, shrink it as much as possible. If DELTA is greater than | 1983 | lines, shrink it as much as possible. If DELTA is greater than |
| 1981 | zero, this function can resize fixed-size subwindows in order to | 1984 | zero, this function can resize fixed-size windows in order to |
| 1982 | recover the necessary lines. | 1985 | recover the necessary lines. |
| 1983 | 1986 | ||
| 1984 | Return the number of lines that were recovered. | 1987 | Return the number of lines that were recovered. |
| @@ -2214,9 +2217,9 @@ is the frame's minibuffer window. | |||
| 2214 | If the root window is not split, ROOT is the root window itself. | 2217 | If the root window is not split, ROOT is the root window itself. |
| 2215 | Otherwise, ROOT is a list (DIR EDGES W1 W2 ...) where DIR is nil | 2218 | Otherwise, ROOT is a list (DIR EDGES W1 W2 ...) where DIR is nil |
| 2216 | for a horizontal split, and t for a vertical split. EDGES gives | 2219 | for a horizontal split, and t for a vertical split. EDGES gives |
| 2217 | the combined size and position of the subwindows in the split, | 2220 | the combined size and position of the child windows in the split, |
| 2218 | and the rest of the elements are the subwindows in the split. | 2221 | and the rest of the elements are the child windows in the split. |
| 2219 | Each of the subwindows may again be a window or a list | 2222 | Each of the child windows may again be a window or a list |
| 2220 | representing a window split, and so on. EDGES is a list \(LEFT | 2223 | representing a window split, and so on. EDGES is a list \(LEFT |
| 2221 | TOP RIGHT BOTTOM) as returned by `window-edges'." | 2224 | TOP RIGHT BOTTOM) as returned by `window-edges'." |
| 2222 | (setq frame (window-normalize-frame frame)) | 2225 | (setq frame (window-normalize-frame frame)) |
| @@ -2352,13 +2355,13 @@ frame." | |||
| 2352 | ;; frame. | 2355 | ;; frame. |
| 2353 | t)))) | 2356 | t)))) |
| 2354 | 2357 | ||
| 2355 | (defun window-or-subwindow-p (subwindow window) | 2358 | (defun window--in-subtree-p (window root) |
| 2356 | "Return t if SUBWINDOW is either WINDOW or a subwindow of WINDOW." | 2359 | "Return t if WINDOW is either ROOT or a member of ROOT's subtree." |
| 2357 | (or (eq subwindow window) | 2360 | (or (eq window root) |
| 2358 | (let ((parent (window-parent subwindow))) | 2361 | (let ((parent (window-parent window))) |
| 2359 | (catch 'done | 2362 | (catch 'done |
| 2360 | (while parent | 2363 | (while parent |
| 2361 | (if (eq parent window) | 2364 | (if (eq parent root) |
| 2362 | (throw 'done t) | 2365 | (throw 'done t) |
| 2363 | (setq parent (window-parent parent)))))))) | 2366 | (setq parent (window-parent parent)))))))) |
| 2364 | 2367 | ||
| @@ -2410,7 +2413,7 @@ non-side window, signal an error." | |||
| 2410 | (let* ((horizontal (window-left-child parent)) | 2413 | (let* ((horizontal (window-left-child parent)) |
| 2411 | (size (window-total-size window horizontal)) | 2414 | (size (window-total-size window horizontal)) |
| 2412 | (frame-selected | 2415 | (frame-selected |
| 2413 | (window-or-subwindow-p (frame-selected-window frame) window)) | 2416 | (window--in-subtree-p (frame-selected-window frame) window)) |
| 2414 | ;; Emacs 23 preferably gives WINDOW's space to its left | 2417 | ;; Emacs 23 preferably gives WINDOW's space to its left |
| 2415 | ;; sibling. | 2418 | ;; sibling. |
| 2416 | (sibling (or (window-left window) (window-right window)))) | 2419 | (sibling (or (window-left window) (window-right window)))) |
| @@ -3126,8 +3129,8 @@ frame. The selected window is not changed by this function." | |||
| 3126 | ;; The `split-window' parameter specifies the function to call. | 3129 | ;; The `split-window' parameter specifies the function to call. |
| 3127 | ;; If that function is `ignore', do nothing. | 3130 | ;; If that function is `ignore', do nothing. |
| 3128 | (throw 'done (funcall function window size side))) | 3131 | (throw 'done (funcall function window size side))) |
| 3129 | ;; If WINDOW is a subwindow of an atomic window, split the root | 3132 | ;; If WINDOW is part of an atomic window, split the root window |
| 3130 | ;; window of that atomic window instead. | 3133 | ;; of that atomic window instead. |
| 3131 | ((and (window-parameter window 'window-atom) | 3134 | ((and (window-parameter window 'window-atom) |
| 3132 | (setq atom-root (window-atom-root window)) | 3135 | (setq atom-root (window-atom-root window)) |
| 3133 | (not (eq atom-root window))) | 3136 | (not (eq atom-root window))) |
| @@ -3249,7 +3252,7 @@ frame. The selected window is not changed by this function." | |||
| 3249 | ;; we won't be able to return space to those windows when we | 3252 | ;; we won't be able to return space to those windows when we |
| 3250 | ;; delete the one we create here. Hence we do not go up. | 3253 | ;; delete the one we create here. Hence we do not go up. |
| 3251 | (progn | 3254 | (progn |
| 3252 | (window--resize-subwindows parent (- new-size) horizontal) | 3255 | (window--resize-child-windows parent (- new-size) horizontal) |
| 3253 | (let* ((normal (- 1.0 new-normal)) | 3256 | (let* ((normal (- 1.0 new-normal)) |
| 3254 | (sub (window-child parent))) | 3257 | (sub (window-child parent))) |
| 3255 | (while sub | 3258 | (while sub |
| @@ -3365,8 +3368,8 @@ right, if any." | |||
| 3365 | ;;; Balancing windows. | 3368 | ;;; Balancing windows. |
| 3366 | 3369 | ||
| 3367 | ;; The following routine uses the recycled code from an old version of | 3370 | ;; The following routine uses the recycled code from an old version of |
| 3368 | ;; `window--resize-subwindows'. It's not very pretty, but coding it the way the | 3371 | ;; `window--resize-child-windows'. It's not very pretty, but coding it the way the |
| 3369 | ;; new `window--resize-subwindows' code does would hardly make it any shorter or | 3372 | ;; new `window--resize-child-windows' code does would hardly make it any shorter or |
| 3370 | ;; more readable (FWIW we'd need three loops - one to calculate the | 3373 | ;; more readable (FWIW we'd need three loops - one to calculate the |
| 3371 | ;; minimum sizes per window, one to enlarge or shrink windows until the | 3374 | ;; minimum sizes per window, one to enlarge or shrink windows until the |
| 3372 | ;; new parent-size matches, and one where we shrink the largest/enlarge | 3375 | ;; new parent-size matches, and one where we shrink the largest/enlarge |
| @@ -3395,14 +3398,14 @@ is non-nil." | |||
| 3395 | (setq failed nil) | 3398 | (setq failed nil) |
| 3396 | (setq sub first) | 3399 | (setq sub first) |
| 3397 | (while (and sub (not failed)) | 3400 | (while (and sub (not failed)) |
| 3398 | ;; Ignore subwindows that should be ignored or are stuck. | 3401 | ;; Ignore child windows that should be ignored or are stuck. |
| 3399 | (unless (window--resize-subwindows-skip-p sub) | 3402 | (unless (window--resize-child-windows-skip-p sub) |
| 3400 | (setq found t) | 3403 | (setq found t) |
| 3401 | (setq sub-total (window-total-size sub horizontal)) | 3404 | (setq sub-total (window-total-size sub horizontal)) |
| 3402 | (setq sub-delta (- size sub-total)) | 3405 | (setq sub-delta (- size sub-total)) |
| 3403 | (setq sub-amount | 3406 | (setq sub-amount |
| 3404 | (window-sizable sub sub-delta horizontal)) | 3407 | (window-sizable sub sub-delta horizontal)) |
| 3405 | ;; Register the new total size for this subwindow. | 3408 | ;; Register the new total size for this child window. |
| 3406 | (set-window-new-total sub (+ sub-total sub-amount)) | 3409 | (set-window-new-total sub (+ sub-total sub-amount)) |
| 3407 | (unless (= sub-amount sub-delta) | 3410 | (unless (= sub-amount sub-delta) |
| 3408 | (setq total-sum (- total-sum sub-total sub-amount)) | 3411 | (setq total-sum (- total-sum sub-total sub-amount)) |
| @@ -3417,7 +3420,7 @@ is non-nil." | |||
| 3417 | ;; (column) until `rest' is zero. | 3420 | ;; (column) until `rest' is zero. |
| 3418 | (setq sub first) | 3421 | (setq sub first) |
| 3419 | (while (and sub (> rest 0)) | 3422 | (while (and sub (> rest 0)) |
| 3420 | (unless (window--resize-subwindows-skip-p window) | 3423 | (unless (window--resize-child-windows-skip-p window) |
| 3421 | (set-window-new-total sub 1 t) | 3424 | (set-window-new-total sub 1 t) |
| 3422 | (setq rest (1- rest))) | 3425 | (setq rest (1- rest))) |
| 3423 | (setq sub (window-right sub))) | 3426 | (setq sub (window-right sub))) |
| @@ -3439,7 +3442,7 @@ is non-nil." | |||
| 3439 | (window-total-size sub horizontal) | 3442 | (window-total-size sub horizontal) |
| 3440 | (window-new-total sub)) | 3443 | (window-new-total sub)) |
| 3441 | (float parent-size))) | 3444 | (float parent-size))) |
| 3442 | ;; Recursively balance each subwindow's subwindows. | 3445 | ;; Recursively balance each window's child windows. |
| 3443 | (balance-windows-1 sub horizontal) | 3446 | (balance-windows-1 sub horizontal) |
| 3444 | (setq sub (window-right sub))))) | 3447 | (setq sub (window-right sub))))) |
| 3445 | 3448 | ||
| @@ -3456,11 +3459,11 @@ is non-nil." | |||
| 3456 | (setq sub (window-right sub)))))))) | 3459 | (setq sub (window-right sub)))))))) |
| 3457 | 3460 | ||
| 3458 | (defun balance-windows (&optional window-or-frame) | 3461 | (defun balance-windows (&optional window-or-frame) |
| 3459 | "Balance the sizes of subwindows of WINDOW-OR-FRAME. | 3462 | "Balance the sizes of windows of WINDOW-OR-FRAME. |
| 3460 | WINDOW-OR-FRAME is optional and defaults to the selected frame. | 3463 | WINDOW-OR-FRAME is optional and defaults to the selected frame. |
| 3461 | If WINDOW-OR-FRAME denotes a frame, balance the sizes of all | 3464 | If WINDOW-OR-FRAME denotes a frame, balance the sizes of all |
| 3462 | subwindows of that frame's root window. If WINDOW-OR-FRAME | 3465 | windows of that frame. If WINDOW-OR-FRAME denots a window, |
| 3463 | denots a window, balance the sizes of all subwindows of that | 3466 | recursively balance the sizes of all child windows of that |
| 3464 | window." | 3467 | window." |
| 3465 | (interactive) | 3468 | (interactive) |
| 3466 | (let* ((window | 3469 | (let* ((window |
| @@ -3680,8 +3683,8 @@ value can be also stored on disk and read back in a new session." | |||
| 3680 | (error "%s is not a live or internal window" window)) | 3683 | (error "%s is not a live or internal window" window)) |
| 3681 | (frame-root-window))) | 3684 | (frame-root-window))) |
| 3682 | ;; The return value is a cons whose car specifies some constraints on | 3685 | ;; The return value is a cons whose car specifies some constraints on |
| 3683 | ;; the size of WINDOW. The cdr lists the states of the subwindows of | 3686 | ;; the size of WINDOW. The cdr lists the states of the child windows |
| 3684 | ;; WINDOW. | 3687 | ;; of WINDOW. |
| 3685 | (cons | 3688 | (cons |
| 3686 | ;; Frame related things would go into a function, say `frame-state', | 3689 | ;; Frame related things would go into a function, say `frame-state', |
| 3687 | ;; calling `window-state-get' to insert the frame's root window. | 3690 | ;; calling `window-state-get' to insert the frame's root window. |
| @@ -3843,7 +3846,7 @@ specify a live window and defaults to the selected one. | |||
| 3843 | 3846 | ||
| 3844 | Optional argument IGNORE non-nil means ignore minimum window | 3847 | Optional argument IGNORE non-nil means ignore minimum window |
| 3845 | sizes and fixed size restrictions. IGNORE equal `safe' means | 3848 | sizes and fixed size restrictions. IGNORE equal `safe' means |
| 3846 | subwindows can get as small as `window-safe-min-height' and | 3849 | windows can get as small as `window-safe-min-height' and |
| 3847 | `window-safe-min-width'." | 3850 | `window-safe-min-width'." |
| 3848 | (setq window (window-normalize-window window t)) | 3851 | (setq window (window-normalize-window window t)) |
| 3849 | (let* ((frame (window-frame window)) | 3852 | (let* ((frame (window-frame window)) |
diff --git a/src/ChangeLog b/src/ChangeLog index 3711292ad35..5b406a7bc46 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,16 @@ | |||
| 1 | 2011-11-07 Martin Rudalics <rudalics@gmx.at> | ||
| 2 | |||
| 3 | * window.h: Declare delete_all_child_windows instead of | ||
| 4 | delete_all_subwindows. | ||
| 5 | * window.c (Fwindow_nest, Fset_window_nest) | ||
| 6 | (Fset_window_new_total, Fset_window_new_normal) | ||
| 7 | (Fwindow_resize_apply): Don't use term subwindow in doc-strings. | ||
| 8 | (delete_all_subwindows): Rename to delete_all_child_windows. | ||
| 9 | (Fdelete_other_windows_internal, Fset_window_configuration): | ||
| 10 | Call delete_all_child_windows instead of delete_all_subwindows. | ||
| 11 | * frame.c (delete_frame): Call delete_all_child_windows instead | ||
| 12 | of delete_all_subwindows. | ||
| 13 | |||
| 1 | 2011-11-07 Paul Eggert <eggert@cs.ucla.edu> | 14 | 2011-11-07 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 15 | ||
| 3 | * alloc.c (DEADP): New macro, for porting to GNU/Hurd (Bug#9926). | 16 | * alloc.c (DEADP): New macro, for porting to GNU/Hurd (Bug#9926). |
diff --git a/src/frame.c b/src/frame.c index 112f102a1f2..d56a2efb17f 100644 --- a/src/frame.c +++ b/src/frame.c | |||
| @@ -1320,7 +1320,7 @@ delete_frame (Lisp_Object frame, Lisp_Object force) | |||
| 1320 | 1320 | ||
| 1321 | /* Mark all the windows that used to be on FRAME as deleted, and then | 1321 | /* Mark all the windows that used to be on FRAME as deleted, and then |
| 1322 | remove the reference to them. */ | 1322 | remove the reference to them. */ |
| 1323 | delete_all_subwindows (f->root_window); | 1323 | delete_all_child_windows (f->root_window); |
| 1324 | f->root_window = Qnil; | 1324 | f->root_window = Qnil; |
| 1325 | 1325 | ||
| 1326 | Vframe_list = Fdelq (frame, Vframe_list); | 1326 | Vframe_list = Fdelq (frame, Vframe_list); |
diff --git a/src/window.c b/src/window.c index 5cc77fb8f02..078b39cc2f1 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -506,8 +506,8 @@ DEFUN ("window-nest", Fwindow_nest, Swindow_nest, 0, 1, 0, | |||
| 506 | doc: /* Return nest status of window WINDOW. | 506 | doc: /* Return nest status of window WINDOW. |
| 507 | If WINDOW is omitted or nil, it defaults to the selected window. | 507 | If WINDOW is omitted or nil, it defaults to the selected window. |
| 508 | 508 | ||
| 509 | If the return value is nil, subwindows of WINDOW can be recombined with | 509 | If the return value is nil, child windows of WINDOW can be recombined with |
| 510 | WINDOW's siblings. A return value of non-nil means that subwindows of | 510 | WINDOW's siblings. A return value of non-nil means that child windows of |
| 511 | WINDOW are never \(re-)combined with WINDOW's siblings. */) | 511 | WINDOW are never \(re-)combined with WINDOW's siblings. */) |
| 512 | (Lisp_Object window) | 512 | (Lisp_Object window) |
| 513 | { | 513 | { |
| @@ -518,8 +518,8 @@ DEFUN ("set-window-nest", Fset_window_nest, Sset_window_nest, 2, 2, 0, | |||
| 518 | doc: /* Set nest status of window WINDOW to STATUS; return STATUS. | 518 | doc: /* Set nest status of window WINDOW to STATUS; return STATUS. |
| 519 | If WINDOW is omitted or nil, it defaults to the selected window. | 519 | If WINDOW is omitted or nil, it defaults to the selected window. |
| 520 | 520 | ||
| 521 | If STATUS is nil, subwindows of WINDOW can be recombined with WINDOW's | 521 | If STATUS is nil, child windows of WINDOW can be recombined with WINDOW's |
| 522 | siblings. STATUS non-nil means that subwindows of WINDOW are never | 522 | siblings. STATUS non-nil means that child windows of WINDOW are never |
| 523 | \(re-)combined with WINDOW's siblings. */) | 523 | \(re-)combined with WINDOW's siblings. */) |
| 524 | (Lisp_Object window, Lisp_Object status) | 524 | (Lisp_Object window, Lisp_Object status) |
| 525 | { | 525 | { |
| @@ -2573,9 +2573,9 @@ DEFUN ("delete-other-windows-internal", Fdelete_other_windows_internal, | |||
| 2573 | Only the frame WINDOW is on is affected. WINDOW may be any window and | 2573 | Only the frame WINDOW is on is affected. WINDOW may be any window and |
| 2574 | defaults to the selected one. | 2574 | defaults to the selected one. |
| 2575 | 2575 | ||
| 2576 | Optional argument ROOT, if non-nil, must specify an internal window | 2576 | Optional argument ROOT, if non-nil, must specify an internal window such |
| 2577 | containing WINDOW as a subwindow. If this is the case, replace ROOT by | 2577 | that WINDOW is in its window subtree. If this is the case, replace ROOT |
| 2578 | WINDOW and leave alone any windows not contained in ROOT. | 2578 | by WINDOW and leave alone any windows not part of ROOT's subtree. |
| 2579 | 2579 | ||
| 2580 | When WINDOW is live try to reduce display jumps by keeping the text | 2580 | When WINDOW is live try to reduce display jumps by keeping the text |
| 2581 | previously visible in WINDOW in the same place on the frame. Doing this | 2581 | previously visible in WINDOW in the same place on the frame. Doing this |
| @@ -2639,10 +2639,10 @@ window-start value is reasonable when this function is called. */) | |||
| 2639 | } | 2639 | } |
| 2640 | else | 2640 | else |
| 2641 | { | 2641 | { |
| 2642 | /* See if the frame's selected window is a subwindow of WINDOW, by | 2642 | /* See if the frame's selected window is a part of the window |
| 2643 | finding all the selected window's parents and comparing each | 2643 | subtree rooted at WINDOW, by finding all the selected window's |
| 2644 | one with WINDOW. If it isn't we need a new selected window for | 2644 | parents and comparing each one with WINDOW. If it isn't we |
| 2645 | this frame. */ | 2645 | need a new selected window for this frame. */ |
| 2646 | swindow = FRAME_SELECTED_WINDOW (f); | 2646 | swindow = FRAME_SELECTED_WINDOW (f); |
| 2647 | while (1) | 2647 | while (1) |
| 2648 | { | 2648 | { |
| @@ -2678,7 +2678,7 @@ window-start value is reasonable when this function is called. */) | |||
| 2678 | 2678 | ||
| 2679 | if (NILP (w->buffer)) | 2679 | if (NILP (w->buffer)) |
| 2680 | { | 2680 | { |
| 2681 | /* Resize subwindows vertically. */ | 2681 | /* Resize child windows vertically. */ |
| 2682 | XSETINT (delta, XINT (r->total_lines) - XINT (w->total_lines)); | 2682 | XSETINT (delta, XINT (r->total_lines) - XINT (w->total_lines)); |
| 2683 | w->top_line = r->top_line; | 2683 | w->top_line = r->top_line; |
| 2684 | resize_root_window (window, delta, Qnil, Qnil); | 2684 | resize_root_window (window, delta, Qnil, Qnil); |
| @@ -2693,7 +2693,7 @@ window-start value is reasonable when this function is called. */) | |||
| 2693 | resize_failed = 1; | 2693 | resize_failed = 1; |
| 2694 | } | 2694 | } |
| 2695 | 2695 | ||
| 2696 | /* Resize subwindows horizontally. */ | 2696 | /* Resize child windows horizontally. */ |
| 2697 | if (!resize_failed) | 2697 | if (!resize_failed) |
| 2698 | { | 2698 | { |
| 2699 | w->left_col = r->left_col; | 2699 | w->left_col = r->left_col; |
| @@ -2742,15 +2742,15 @@ window-start value is reasonable when this function is called. */) | |||
| 2742 | XWINDOW (w->parent)->hchild = sibling; | 2742 | XWINDOW (w->parent)->hchild = sibling; |
| 2743 | } | 2743 | } |
| 2744 | 2744 | ||
| 2745 | /* Delete ROOT and all subwindows of ROOT. */ | 2745 | /* Delete ROOT and all child windows of ROOT. */ |
| 2746 | if (!NILP (r->vchild)) | 2746 | if (!NILP (r->vchild)) |
| 2747 | { | 2747 | { |
| 2748 | delete_all_subwindows (r->vchild); | 2748 | delete_all_child_windows (r->vchild); |
| 2749 | r->vchild = Qnil; | 2749 | r->vchild = Qnil; |
| 2750 | } | 2750 | } |
| 2751 | else if (!NILP (r->hchild)) | 2751 | else if (!NILP (r->hchild)) |
| 2752 | { | 2752 | { |
| 2753 | delete_all_subwindows (r->hchild); | 2753 | delete_all_child_windows (r->hchild); |
| 2754 | r->hchild = Qnil; | 2754 | r->hchild = Qnil; |
| 2755 | } | 2755 | } |
| 2756 | 2756 | ||
| @@ -3351,7 +3351,7 @@ Return SIZE. | |||
| 3351 | Optional argument ADD non-nil means add SIZE to the new total size of | 3351 | Optional argument ADD non-nil means add SIZE to the new total size of |
| 3352 | WINDOW and return the sum. | 3352 | WINDOW and return the sum. |
| 3353 | 3353 | ||
| 3354 | Note: This function does not operate on any subwindows of WINDOW. */) | 3354 | Note: This function does not operate on any child windows of WINDOW. */) |
| 3355 | (Lisp_Object window, Lisp_Object size, Lisp_Object add) | 3355 | (Lisp_Object window, Lisp_Object size, Lisp_Object add) |
| 3356 | { | 3356 | { |
| 3357 | struct window *w = decode_any_window (window); | 3357 | struct window *w = decode_any_window (window); |
| @@ -3369,7 +3369,7 @@ DEFUN ("set-window-new-normal", Fset_window_new_normal, Sset_window_new_normal, | |||
| 3369 | doc: /* Set new normal size of WINDOW to SIZE. | 3369 | doc: /* Set new normal size of WINDOW to SIZE. |
| 3370 | Return SIZE. | 3370 | Return SIZE. |
| 3371 | 3371 | ||
| 3372 | Note: This function does not operate on any subwindows of WINDOW. */) | 3372 | Note: This function does not operate on any child windows of WINDOW. */) |
| 3373 | (Lisp_Object window, Lisp_Object size) | 3373 | (Lisp_Object window, Lisp_Object size) |
| 3374 | { | 3374 | { |
| 3375 | struct window *w = decode_any_window (window); | 3375 | struct window *w = decode_any_window (window); |
| @@ -3380,7 +3380,7 @@ Note: This function does not operate on any subwindows of WINDOW. */) | |||
| 3380 | 3380 | ||
| 3381 | /* Return 1 if setting w->total_lines (w->total_cols if HORFLAG is | 3381 | /* Return 1 if setting w->total_lines (w->total_cols if HORFLAG is |
| 3382 | non-zero) to w->new_total would result in correct heights (widths) | 3382 | non-zero) to w->new_total would result in correct heights (widths) |
| 3383 | for window W and recursively all subwindows of W. | 3383 | for window W and recursively all child windows of W. |
| 3384 | 3384 | ||
| 3385 | Note: This function does not check any of `window-fixed-size-p', | 3385 | Note: This function does not check any of `window-fixed-size-p', |
| 3386 | `window-min-height' or `window-min-width'. It does check that window | 3386 | `window-min-height' or `window-min-width'. It does check that window |
| @@ -3395,7 +3395,7 @@ window_resize_check (struct window *w, int horflag) | |||
| 3395 | { | 3395 | { |
| 3396 | c = XWINDOW (w->vchild); | 3396 | c = XWINDOW (w->vchild); |
| 3397 | if (horflag) | 3397 | if (horflag) |
| 3398 | /* All subwindows of W must have the same width as W. */ | 3398 | /* All child windows of W must have the same width as W. */ |
| 3399 | { | 3399 | { |
| 3400 | while (c) | 3400 | while (c) |
| 3401 | { | 3401 | { |
| @@ -3407,8 +3407,8 @@ window_resize_check (struct window *w, int horflag) | |||
| 3407 | return 1; | 3407 | return 1; |
| 3408 | } | 3408 | } |
| 3409 | else | 3409 | else |
| 3410 | /* The sum of the heights of the subwindows of W must equal W's | 3410 | /* The sum of the heights of the child windows of W must equal |
| 3411 | height. */ | 3411 | W's height. */ |
| 3412 | { | 3412 | { |
| 3413 | int sum_of_sizes = 0; | 3413 | int sum_of_sizes = 0; |
| 3414 | while (c) | 3414 | while (c) |
| @@ -3426,7 +3426,7 @@ window_resize_check (struct window *w, int horflag) | |||
| 3426 | { | 3426 | { |
| 3427 | c = XWINDOW (w->hchild); | 3427 | c = XWINDOW (w->hchild); |
| 3428 | if (horflag) | 3428 | if (horflag) |
| 3429 | /* The sum of the widths of the subwindows of W must equal W's | 3429 | /* The sum of the widths of the child windows of W must equal W's |
| 3430 | width. */ | 3430 | width. */ |
| 3431 | { | 3431 | { |
| 3432 | int sum_of_sizes = 0; | 3432 | int sum_of_sizes = 0; |
| @@ -3440,7 +3440,7 @@ window_resize_check (struct window *w, int horflag) | |||
| 3440 | return (sum_of_sizes == XINT (w->new_total)); | 3440 | return (sum_of_sizes == XINT (w->new_total)); |
| 3441 | } | 3441 | } |
| 3442 | else | 3442 | else |
| 3443 | /* All subwindows of W must have the same height as W. */ | 3443 | /* All child windows of W must have the same height as W. */ |
| 3444 | { | 3444 | { |
| 3445 | while (c) | 3445 | while (c) |
| 3446 | { | 3446 | { |
| @@ -3460,9 +3460,9 @@ window_resize_check (struct window *w, int horflag) | |||
| 3460 | } | 3460 | } |
| 3461 | 3461 | ||
| 3462 | /* Set w->total_lines (w->total_cols if HORIZONTAL is non-zero) to | 3462 | /* Set w->total_lines (w->total_cols if HORIZONTAL is non-zero) to |
| 3463 | w->new_total for window W and recursively all subwindows of W. Also | 3463 | w->new_total for window W and recursively all child windows of W. |
| 3464 | calculate and assign the new vertical (horizontal) start positions of | 3464 | Also calculate and assign the new vertical (horizontal) start |
| 3465 | each of these windows. | 3465 | positions of each of these windows. |
| 3466 | 3466 | ||
| 3467 | This function does not perform any error checks. Make sure you have | 3467 | This function does not perform any error checks. Make sure you have |
| 3468 | run window_resize_check on W before applying this function. */ | 3468 | run window_resize_check on W before applying this function. */ |
| @@ -3536,8 +3536,8 @@ Optional argument HORIZONTAL omitted or nil means apply requested height | |||
| 3536 | values. HORIZONTAL non-nil means apply requested width values. | 3536 | values. HORIZONTAL non-nil means apply requested width values. |
| 3537 | 3537 | ||
| 3538 | This function checks whether the requested values sum up to a valid | 3538 | This function checks whether the requested values sum up to a valid |
| 3539 | window layout, recursively assigns the new sizes of all subwindows and | 3539 | window layout, recursively assigns the new sizes of all child windows |
| 3540 | calculates and assigns the new start positions of these windows. | 3540 | and calculates and assigns the new start positions of these windows. |
| 3541 | 3541 | ||
| 3542 | Note: This function does not check any of `window-fixed-size-p', | 3542 | Note: This function does not check any of `window-fixed-size-p', |
| 3543 | `window-min-height' or `window-min-width'. All these checks have to | 3543 | `window-min-height' or `window-min-width'. All these checks have to |
| @@ -3936,12 +3936,12 @@ Signal an error when WINDOW is the only window on its frame. */) | |||
| 3936 | 3936 | ||
| 3937 | if (!NILP (w->vchild)) | 3937 | if (!NILP (w->vchild)) |
| 3938 | { | 3938 | { |
| 3939 | delete_all_subwindows (w->vchild); | 3939 | delete_all_child_windows (w->vchild); |
| 3940 | w->vchild = Qnil; | 3940 | w->vchild = Qnil; |
| 3941 | } | 3941 | } |
| 3942 | else if (!NILP (w->hchild)) | 3942 | else if (!NILP (w->hchild)) |
| 3943 | { | 3943 | { |
| 3944 | delete_all_subwindows (w->hchild); | 3944 | delete_all_child_windows (w->hchild); |
| 3945 | w->hchild = Qnil; | 3945 | w->hchild = Qnil; |
| 3946 | } | 3946 | } |
| 3947 | else if (!NILP (w->buffer)) | 3947 | else if (!NILP (w->buffer)) |
| @@ -5520,7 +5520,7 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5520 | Save their current buffers in their height fields, since we may | 5520 | Save their current buffers in their height fields, since we may |
| 5521 | need it later, if a buffer saved in the configuration is now | 5521 | need it later, if a buffer saved in the configuration is now |
| 5522 | dead. */ | 5522 | dead. */ |
| 5523 | delete_all_subwindows (FRAME_ROOT_WINDOW (f)); | 5523 | delete_all_child_windows (FRAME_ROOT_WINDOW (f)); |
| 5524 | 5524 | ||
| 5525 | for (k = 0; k < saved_windows->header.size; k++) | 5525 | for (k = 0; k < saved_windows->header.size; k++) |
| 5526 | { | 5526 | { |
| @@ -5734,10 +5734,10 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5734 | } | 5734 | } |
| 5735 | 5735 | ||
| 5736 | 5736 | ||
| 5737 | /* Delete all subwindows reachable via the next, vchild, and hchild | 5737 | /* Recursively delete all child windows reachable via the next, vchild, |
| 5738 | slots of WINDOW. */ | 5738 | and hchild slots of WINDOW. */ |
| 5739 | void | 5739 | void |
| 5740 | delete_all_subwindows (Lisp_Object window) | 5740 | delete_all_child_windows (Lisp_Object window) |
| 5741 | { | 5741 | { |
| 5742 | register struct window *w; | 5742 | register struct window *w; |
| 5743 | 5743 | ||
| @@ -5745,18 +5745,18 @@ delete_all_subwindows (Lisp_Object window) | |||
| 5745 | 5745 | ||
| 5746 | if (!NILP (w->next)) | 5746 | if (!NILP (w->next)) |
| 5747 | /* Delete WINDOW's siblings (we traverse postorderly). */ | 5747 | /* Delete WINDOW's siblings (we traverse postorderly). */ |
| 5748 | delete_all_subwindows (w->next); | 5748 | delete_all_child_windows (w->next); |
| 5749 | 5749 | ||
| 5750 | w->total_lines = w->buffer; /* See Fset_window_configuration for excuse. */ | 5750 | w->total_lines = w->buffer; /* See Fset_window_configuration for excuse. */ |
| 5751 | 5751 | ||
| 5752 | if (!NILP (w->vchild)) | 5752 | if (!NILP (w->vchild)) |
| 5753 | { | 5753 | { |
| 5754 | delete_all_subwindows (w->vchild); | 5754 | delete_all_child_windows (w->vchild); |
| 5755 | w->vchild = Qnil; | 5755 | w->vchild = Qnil; |
| 5756 | } | 5756 | } |
| 5757 | else if (!NILP (w->hchild)) | 5757 | else if (!NILP (w->hchild)) |
| 5758 | { | 5758 | { |
| 5759 | delete_all_subwindows (w->hchild); | 5759 | delete_all_child_windows (w->hchild); |
| 5760 | w->hchild = Qnil; | 5760 | w->hchild = Qnil; |
| 5761 | } | 5761 | } |
| 5762 | else if (!NILP (w->buffer)) | 5762 | else if (!NILP (w->buffer)) |
diff --git a/src/window.h b/src/window.h index c6fa5e7a338..6a9641e3e6d 100644 --- a/src/window.h +++ b/src/window.h | |||
| @@ -824,7 +824,7 @@ extern Lisp_Object window_from_coordinates (struct frame *, int, int, | |||
| 824 | enum window_part *, int); | 824 | enum window_part *, int); |
| 825 | EXFUN (Fwindow_dedicated_p, 1); | 825 | EXFUN (Fwindow_dedicated_p, 1); |
| 826 | extern void resize_frame_windows (struct frame *, int, int); | 826 | extern void resize_frame_windows (struct frame *, int, int); |
| 827 | extern void delete_all_subwindows (Lisp_Object); | 827 | extern void delete_all_child_windows (Lisp_Object); |
| 828 | extern void freeze_window_starts (struct frame *, int); | 828 | extern void freeze_window_starts (struct frame *, int); |
| 829 | extern void grow_mini_window (struct window *, int); | 829 | extern void grow_mini_window (struct window *, int); |
| 830 | extern void shrink_mini_window (struct window *); | 830 | extern void shrink_mini_window (struct window *); |