diff options
| author | Joakim Verona | 2011-11-07 16:08:00 +0100 |
|---|---|---|
| committer | Joakim Verona | 2011-11-07 16:08:00 +0100 |
| commit | 8520d9c4e50520db79410ec6ef0052df129231dc (patch) | |
| tree | 955a62eddf28b5aa3f68842cf440683646067773 /lisp | |
| parent | d66104e9adbe7110dc46e12ea99624d2dff938b2 (diff) | |
| parent | 05a61ee3e61026ee010206355509a2d0e7ec15c2 (diff) | |
| download | emacs-8520d9c4e50520db79410ec6ef0052df129231dc.tar.gz emacs-8520d9c4e50520db79410ec6ef0052df129231dc.zip | |
upstream
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/ChangeLog | 21 | ||||
| -rw-r--r-- | lisp/files.el | 2 | ||||
| -rw-r--r-- | lisp/window.el | 185 |
3 files changed, 116 insertions, 92 deletions
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)) |