aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Rudalics2011-06-09 10:41:36 +0200
committerMartin Rudalics2011-06-09 10:41:36 +0200
commit9aab8e0d8b7b39e0846f1248fb4387486cdce330 (patch)
tree720f6eeb13b42dc9304c9e33a09735e2d3c375ff
parent1a13852e906ca4f4f98a65106496d2cb1c517d64 (diff)
downloademacs-9aab8e0d8b7b39e0846f1248fb4387486cdce330.tar.gz
emacs-9aab8e0d8b7b39e0846f1248fb4387486cdce330.zip
Final preparations in window.el for new window resize code.
* window.el (resize-window-reset, resize-window-reset-1) (resize-subwindows-skip-p, resize-subwindows-normal) (resize-subwindows, resize-other-windows, resize-this-window) (resize-root-window, resize-root-window-vertically) (window-deletable-p, window-or-subwindow-p) (frame-root-window-p): New functions.
-rw-r--r--lisp/ChangeLog9
-rw-r--r--lisp/window.el539
2 files changed, 548 insertions, 0 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 6e08029588a..7b4c4300900 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,12 @@
12011-06-09 Martin Rudalics <rudalics@gmx.at>
2
3 * window.el (resize-window-reset, resize-window-reset-1)
4 (resize-subwindows-skip-p, resize-subwindows-normal)
5 (resize-subwindows, resize-other-windows, resize-this-window)
6 (resize-root-window, resize-root-window-vertically)
7 (window-deletable-p, window-or-subwindow-p)
8 (frame-root-window-p): New functions.
9
12011-06-09 Glenn Morris <rgm@gnu.org> 102011-06-09 Glenn Morris <rgm@gnu.org>
2 11
3 * net/ange-ftp.el (ange-ftp-switches-ok): New function. 12 * net/ange-ftp.el (ange-ftp-switches-ok): New function.
diff --git a/lisp/window.el b/lisp/window.el
index eafa8a4764a..566577ca72f 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -1312,7 +1312,503 @@ The optional argument MINIBUF specifies whether the minibuffer
1312window shall be counted. See `walk-windows' for the precise 1312window shall be counted. See `walk-windows' for the precise
1313meaning of this argument." 1313meaning of this argument."
1314 (length (window-list-1 nil minibuf))) 1314 (length (window-list-1 nil minibuf)))
1315
1316;;; Resizing windows.
1317(defun resize-window-reset (&optional frame horizontal)
1318 "Reset resize values for all windows on FRAME.
1319FRAME defaults to the selected frame.
1320
1321This function stores the current value of `window-total-size' applied
1322with argument HORIZONTAL in the new total size of all windows on
1323FRAME. It also resets the new normal size of each of these
1324windows."
1325 (resize-window-reset-1
1326 (frame-root-window (normalize-live-frame frame)) horizontal))
1327
1328(defun resize-window-reset-1 (window horizontal)
1329 "Internal function of `resize-window-reset'."
1330 ;; Register old size in the new total size.
1331 (set-window-new-total window (window-total-size window horizontal))
1332 ;; Reset new normal size.
1333 (set-window-new-normal window)
1334 (when (window-child window)
1335 (resize-window-reset-1 (window-child window) horizontal))
1336 (when (window-right window)
1337 (resize-window-reset-1 (window-right window) horizontal)))
1338
1339(defsubst resize-subwindows-skip-p (window)
1340 "Return non-nil if WINDOW shall be skipped by resizing routines."
1341 (memq (window-new-normal window) '(ignore stuck skip)))
1342
1343(defun resize-subwindows-normal (parent horizontal window this-delta &optional trail other-delta)
1344 "Set the new normal height of subwindows of window PARENT.
1345HORIZONTAL non-nil means set the new normal width of these
1346windows. WINDOW specifies a subwindow of PARENT that has been
1347resized by THIS-DELTA lines \(columns).
1348
1349Optional argument TRAIL either 'before or 'after means set values
1350for windows before or after WINDOW only. Optional argument
1351OTHER-DELTA a number specifies that this many lines \(columns)
1352have been obtained from \(or returned to) an ancestor window of
1353PARENT in order to resize WINDOW."
1354 (let* ((delta-normal
1355 (if (and (= (- this-delta) (window-total-size window horizontal))
1356 (zerop other-delta))
1357 ;; When WINDOW gets deleted and we can return its entire
1358 ;; space to its siblings, use WINDOW's normal size as the
1359 ;; normal delta.
1360 (- (window-normal-size window horizontal))
1361 ;; In any other case calculate the normal delta from the
1362 ;; relation of THIS-DELTA to the total size of PARENT.
1363 (/ (float this-delta) (window-total-size parent horizontal))))
1364 (sub (window-child parent))
1365 (parent-normal 0.0)
1366 (skip (eq trail 'after)))
1367
1368 ;; Set parent-normal to the sum of the normal sizes of all
1369 ;; subwindows of PARENT that shall be resized, excluding only WINDOW
1370 ;; and any windows specified by the optional TRAIL argument.
1371 (while sub
1372 (cond
1373 ((eq sub window)
1374 (setq skip (eq trail 'before)))
1375 (skip)
1376 (t
1377 (setq parent-normal
1378 (+ parent-normal (window-normal-size sub horizontal)))))
1379 (setq sub (window-right sub)))
1380
1381 ;; Set the new normal size of all subwindows of PARENT from what
1382 ;; they should have contributed for recovering THIS-DELTA lines
1383 ;; (columns).
1384 (setq sub (window-child parent))
1385 (setq skip (eq trail 'after))
1386 (while sub
1387 (cond
1388 ((eq sub window)
1389 (setq skip (eq trail 'before)))
1390 (skip)
1391 (t
1392 (let ((old-normal (window-normal-size sub horizontal)))
1393 (set-window-new-normal
1394 sub (min 1.0 ; Don't get larger than 1.
1395 (max (- old-normal
1396 (* (/ old-normal parent-normal)
1397 delta-normal))
1398 ;; Don't drop below 0.
1399 0.0))))))
1400 (setq sub (window-right sub)))
1401
1402 (when (numberp other-delta)
1403 ;; Set the new normal size of windows from what they should have
1404 ;; contributed for recovering OTHER-DELTA lines (columns).
1405 (setq delta-normal (/ (float (window-total-size parent horizontal))
1406 (+ (window-total-size parent horizontal)
1407 other-delta)))
1408 (setq sub (window-child parent))
1409 (setq skip (eq trail 'after))
1410 (while sub
1411 (cond
1412 ((eq sub window)
1413 (setq skip (eq trail 'before)))
1414 (skip)
1415 (t
1416 (set-window-new-normal
1417 sub (min 1.0 ; Don't get larger than 1.
1418 (max (* (window-new-normal sub) delta-normal)
1419 ;; Don't drop below 0.
1420 0.0)))))
1421 (setq sub (window-right sub))))
1422
1423 ;; Set the new normal size of WINDOW to what is left by the sum of
1424 ;; the normal sizes of its siblings.
1425 (set-window-new-normal
1426 window
1427 (let ((sum 0))
1428 (setq sub (window-child parent))
1429 (while sub
1430 (cond
1431 ((eq sub window))
1432 ((not (numberp (window-new-normal sub)))
1433 (setq sum (+ sum (window-normal-size sub horizontal))))
1434 (t
1435 (setq sum (+ sum (window-new-normal sub)))))
1436 (setq sub (window-right sub)))
1437 ;; Don't get larger than 1 or smaller than 0.
1438 (min 1.0 (max (- 1.0 sum) 0.0))))))
1439
1440(defun resize-subwindows (parent delta &optional horizontal window ignore trail edge)
1441 "Resize subwindows of window PARENT vertically by DELTA lines.
1442PARENT must be a vertically combined internal window.
1315 1443
1444Optional argument HORIZONTAL non-nil means resize subwindows of
1445PARENT horizontally by DELTA columns. In this case PARENT must
1446be a horizontally combined internal window.
1447
1448WINDOW, if specified, must denote a child window of PARENT that
1449is resized by DELTA lines.
1450
1451Optional argument IGNORE non-nil means ignore any restrictions
1452imposed by fixed size windows, `window-min-height' or
1453`window-min-width' settings. IGNORE equal `safe' means live
1454windows may get as small as `window-safe-min-height' lines and
1455`window-safe-min-width' columns. IGNORE any window means ignore
1456restrictions for that window only.
1457
1458Optional arguments TRAIL and EDGE, when non-nil, restrict the set
1459of windows that shall be resized. If TRAIL equals `before',
1460resize only windows on the left or above EDGE. If TRAIL equals
1461`after', resize only windows on the right or below EDGE. Also,
1462preferably only resize windows adjacent to EDGE.
1463
1464Return the symbol `normalized' if new normal sizes have been
1465already set by this routine."
1466 (let* ((first (window-child parent))
1467 (sub first)
1468 (parent-total (+ (window-total-size parent horizontal) delta))
1469 best-window best-value)
1470
1471 (if (and edge (memq trail '(before after))
1472 (progn
1473 (setq sub first)
1474 (while (and (window-right sub)
1475 (or (and (eq trail 'before)
1476 (not (resize-subwindows-skip-p
1477 (window-right sub))))
1478 (and (eq trail 'after)
1479 (resize-subwindows-skip-p sub))))
1480 (setq sub (window-right sub)))
1481 sub)
1482 (if horizontal
1483 (if (eq trail 'before)
1484 (= (+ (window-left-column sub)
1485 (window-total-size sub t))
1486 edge)
1487 (= (window-left-column sub) edge))
1488 (if (eq trail 'before)
1489 (= (+ (window-top-line sub)
1490 (window-total-size sub))
1491 edge)
1492 (= (window-top-line sub) edge)))
1493 (window-sizable-p sub delta horizontal ignore))
1494 ;; Resize only windows adjacent to EDGE.
1495 (progn
1496 (resize-this-window sub delta horizontal ignore t trail edge)
1497 (if (and window (eq (window-parent sub) parent))
1498 (progn
1499 ;; Assign new normal sizes.
1500 (set-window-new-normal
1501 sub (/ (float (window-new-total sub)) parent-total))
1502 (set-window-new-normal
1503 window (- (window-normal-size window horizontal)
1504 (- (window-new-normal sub)
1505 (window-normal-size sub horizontal)))))
1506 (resize-subwindows-normal parent horizontal sub 0 trail delta))
1507 ;; Return 'normalized to notify `resize-other-windows' that
1508 ;; normal sizes have been already set.
1509 'normalized)
1510 ;; Resize all windows proportionally.
1511 (setq sub first)
1512 (while sub
1513 (cond
1514 ((or (resize-subwindows-skip-p sub)
1515 ;; Ignore windows to skip and fixed-size subwindows - in
1516 ;; the latter case make it a window to skip.
1517 (and (not ignore)
1518 (window-size-fixed-p sub horizontal)
1519 (set-window-new-normal sub 'ignore))))
1520 ((< delta 0)
1521 ;; When shrinking store the number of lines/cols we can get
1522 ;; from this window here together with the total/normal size
1523 ;; factor.
1524 (set-window-new-normal
1525 sub
1526 (cons
1527 ;; We used to call this with NODOWN t, "fixed" 2011-05-11.
1528 (window-min-delta sub horizontal ignore trail t) ; t)
1529 (- (/ (float (window-total-size sub horizontal))
1530 parent-total)
1531 (window-normal-size sub horizontal)))))
1532 ((> delta 0)
1533 ;; When enlarging store the total/normal size factor only
1534 (set-window-new-normal
1535 sub
1536 (- (/ (float (window-total-size sub horizontal))
1537 parent-total)
1538 (window-normal-size sub horizontal)))))
1539
1540 (setq sub (window-right sub)))
1541
1542 (cond
1543 ((< delta 0)
1544 ;; Shrink windows by delta.
1545 (setq best-window t)
1546 (while (and best-window (not (zerop delta)))
1547 (setq sub first)
1548 (setq best-window nil)
1549 (setq best-value most-negative-fixnum)
1550 (while sub
1551 (when (and (consp (window-new-normal sub))
1552 (not (zerop (car (window-new-normal sub))))
1553 (> (cdr (window-new-normal sub)) best-value))
1554 (setq best-window sub)
1555 (setq best-value (cdr (window-new-normal sub))))
1556
1557 (setq sub (window-right sub)))
1558
1559 (when best-window
1560 (setq delta (1+ delta)))
1561 (set-window-new-total best-window -1 t)
1562 (set-window-new-normal
1563 best-window
1564 (if (= (car (window-new-normal best-window)) 1)
1565 'skip ; We can't shrink best-window any further.
1566 (cons (1- (car (window-new-normal best-window)))
1567 (- (/ (float (window-new-total best-window))
1568 parent-total)
1569 (window-normal-size best-window horizontal)))))))
1570 ((> delta 0)
1571 ;; Enlarge windows by delta.
1572 (setq best-window t)
1573 (while (and best-window (not (zerop delta)))
1574 (setq sub first)
1575 (setq best-window nil)
1576 (setq best-value most-positive-fixnum)
1577 (while sub
1578 (when (and (numberp (window-new-normal sub))
1579 (< (window-new-normal sub) best-value))
1580 (setq best-window sub)
1581 (setq best-value (window-new-normal sub)))
1582
1583 (setq sub (window-right sub)))
1584
1585 (when best-window
1586 (setq delta (1- delta)))
1587 (set-window-new-total best-window 1 t)
1588 (set-window-new-normal
1589 best-window
1590 (- (/ (float (window-new-total best-window))
1591 parent-total)
1592 (window-normal-size best-window horizontal))))))
1593
1594 (when best-window
1595 (setq sub first)
1596 (while sub
1597 (when (or (consp (window-new-normal sub))
1598 (numberp (window-new-normal sub)))
1599 ;; Reset new normal size fields so `resize-window-apply'
1600 ;; won't use them to apply new sizes.
1601 (set-window-new-normal sub))
1602
1603 (unless (eq (window-new-normal sub) 'ignore)
1604 ;; Resize this subwindow's subwindows (back-engineering
1605 ;; delta from sub's old and new total sizes).
1606 (let ((delta (- (window-new-total sub)
1607 (window-total-size sub horizontal))))
1608 (unless (and (zerop delta) (not trail))
1609 ;; For the TRAIL non-nil case we have to resize SUB
1610 ;; recursively even if it's size does not change.
1611 (resize-this-window
1612 sub delta horizontal ignore nil trail edge))))
1613 (setq sub (window-right sub)))))))
1614
1615(defun resize-other-windows (window delta &optional horizontal ignore trail edge)
1616 "Resize other windows when WINDOW is resized vertically by DELTA lines.
1617Optional argument HORIZONTAL non-nil means resize other windows
1618when WINDOW is resized horizontally by DELTA columns. WINDOW
1619itself is not resized by this function.
1620
1621Optional argument IGNORE non-nil means ignore any restrictions
1622imposed by fixed size windows, `window-min-height' or
1623`window-min-width' settings. IGNORE equal `safe' means live
1624windows may get as small as `window-safe-min-height' lines and
1625`window-safe-min-width' columns. IGNORE any window means ignore
1626restrictions for that window only.
1627
1628Optional arguments TRAIL and EDGE, when non-nil, refine the set
1629of windows that shall be resized. If TRAIL equals `before',
1630resize only windows on the left or above EDGE. If TRAIL equals
1631`after', resize only windows on the right or below EDGE. Also,
1632preferably only resize windows adjacent to EDGE."
1633 (when (window-parent window)
1634 (let* ((parent (window-parent window))
1635 (sub (window-child parent)))
1636 (if (window-iso-combined-p sub horizontal)
1637 ;; In an iso-combination try to extract DELTA from WINDOW's
1638 ;; siblings.
1639 (let ((first sub)
1640 (skip (eq trail 'after))
1641 this-delta other-delta)
1642 ;; Decide which windows shall be left alone.
1643 (while sub
1644 (cond
1645 ((eq sub window)
1646 ;; Make sure WINDOW is left alone when
1647 ;; resizing its siblings.
1648 (set-window-new-normal sub 'ignore)
1649 (setq skip (eq trail 'before)))
1650 (skip
1651 ;; Make sure this sibling is left alone when
1652 ;; resizing its siblings.
1653 (set-window-new-normal sub 'ignore))
1654 ((or (window-size-ignore sub ignore)
1655 (not (window-size-fixed-p sub horizontal)))
1656 ;; Set this-delta to t to signal that we found a sibling
1657 ;; of WINDOW whose size is not fixed.
1658 (setq this-delta t)))
1659
1660 (setq sub (window-right sub)))
1661
1662 ;; Set this-delta to what we can get from WINDOW's siblings.
1663 (if (= (- delta) (window-total-size window horizontal))
1664 ;; A deletion, presumably. We must handle this case
1665 ;; specially since `window-resizable' can't be used.
1666 (if this-delta
1667 ;; There's at least one resizable sibling we can
1668 ;; give WINDOW's size to.
1669 (setq this-delta delta)
1670 ;; No resizable sibling exists.
1671 (setq this-delta 0))
1672 ;; Any other form of resizing.
1673 (setq this-delta
1674 (window-resizable window delta horizontal ignore trail t)))
1675
1676 ;; Set other-delta to what we still have to get from
1677 ;; ancestor windows of parent.
1678 (setq other-delta (- delta this-delta))
1679 (unless (zerop other-delta)
1680 ;; Unless we got everything from WINDOW's siblings, PARENT
1681 ;; must be resized by other-delta lines or columns.
1682 (set-window-new-total parent other-delta 'add))
1683
1684 (if (zerop this-delta)
1685 ;; We haven't got anything from WINDOW's siblings but we
1686 ;; must update the normal sizes to respect other-delta.
1687 (resize-subwindows-normal
1688 parent horizontal window this-delta trail other-delta)
1689 ;; We did get something from WINDOW's siblings which means
1690 ;; we have to resize their subwindows.
1691 (unless (eq (resize-subwindows parent (- this-delta) horizontal
1692 window ignore trail edge)
1693 ;; `resize-subwindows' returning 'normalized,
1694 ;; means it has set the normal sizes already.
1695 'normalized)
1696 ;; Set the normal sizes.
1697 (resize-subwindows-normal
1698 parent horizontal window this-delta trail other-delta))
1699 ;; Set DELTA to what we still have to get from ancestor
1700 ;; windows.
1701 (setq delta other-delta)))
1702
1703 ;; In an ortho-combination all siblings of WINDOW must be
1704 ;; resized by DELTA.
1705 (set-window-new-total parent delta 'add)
1706 (while sub
1707 (unless (eq sub window)
1708 (resize-this-window sub delta horizontal ignore t))
1709 (setq sub (window-right sub))))
1710
1711 (unless (zerop delta)
1712 ;; "Go up."
1713 (resize-other-windows parent delta horizontal ignore trail edge)))))
1714
1715(defun resize-this-window (window delta &optional horizontal ignore add trail edge)
1716 "Resize WINDOW vertically by DELTA lines.
1717Optional argument HORIZONTAL non-nil means resize WINDOW
1718horizontally by DELTA columns.
1719
1720Optional argument IGNORE non-nil means ignore any restrictions
1721imposed by fixed size windows, `window-min-height' or
1722`window-min-width' settings. IGNORE equal `safe' means live
1723windows may get as small as `window-safe-min-height' lines and
1724`window-safe-min-width' columns. IGNORE any window means ignore
1725restrictions for that window only.
1726
1727Optional argument ADD non-nil means add DELTA to the new total
1728size of WINDOW.
1729
1730Optional arguments TRAIL and EDGE, when non-nil, refine the set
1731of windows that shall be resized. If TRAIL equals `before',
1732resize only windows on the left or above EDGE. If TRAIL equals
1733`after', resize only windows on the right or below EDGE. Also,
1734preferably only resize windows adjacent to EDGE.
1735
1736This function recursively resizes WINDOW's subwindows to fit the
1737new size. Make sure that WINDOW is `window-resizable' before
1738calling this function. Note that this function does not resize
1739siblings of WINDOW or WINDOW's parent window. You have to
1740eventually call `resize-window-apply' in order to make resizing
1741actually take effect."
1742 (when add
1743 ;; Add DELTA to the new total size of WINDOW.
1744 (set-window-new-total window delta t))
1745
1746 (let ((sub (window-child window)))
1747 (cond
1748 ((not sub))
1749 ((window-iso-combined-p sub horizontal)
1750 ;; In an iso-combination resize subwindows according to their
1751 ;; normal sizes.
1752 (resize-subwindows window delta horizontal nil ignore trail edge))
1753 ;; In an ortho-combination resize each subwindow by DELTA.
1754 (t
1755 (while sub
1756 (resize-this-window sub delta horizontal ignore t trail edge)
1757 (setq sub (window-right sub)))))))
1758
1759(defun resize-root-window (window delta horizontal ignore)
1760 "Resize root window WINDOW vertically by DELTA lines.
1761HORIZONTAL non-nil means resize root window WINDOW horizontally
1762by DELTA columns.
1763
1764IGNORE non-nil means ignore any restrictions imposed by fixed
1765size windows, `window-min-height' or `window-min-width' settings.
1766
1767This function is only called by the frame resizing routines. It
1768resizes windows proportionally and never deletes any windows."
1769 (when (and (windowp window) (numberp delta)
1770 (window-sizable-p window delta horizontal ignore))
1771 (resize-window-reset (window-frame window) horizontal)
1772 (resize-this-window window delta horizontal ignore t)))
1773
1774(defun resize-root-window-vertically (window delta)
1775 "Resize root window WINDOW vertically by DELTA lines.
1776If DELTA is less than zero and we can't shrink WINDOW by DELTA
1777lines, shrink it as much as possible. If DELTA is greater than
1778zero, this function can resize fixed-size subwindows in order to
1779recover the necessary lines.
1780
1781Return the number of lines that were recovered.
1782
1783This function is only called by the minibuffer window resizing
1784routines. It resizes windows proportionally and never deletes
1785any windows."
1786 (when (numberp delta)
1787 (let (ignore)
1788 (cond
1789 ((< delta 0)
1790 (setq delta (window-sizable window delta)))
1791 ((> delta 0)
1792 (unless (window-sizable window delta)
1793 (setq ignore t))))
1794
1795 (resize-window-reset (window-frame window))
1796 ;; Ideally, we would resize just the last window in a combination
1797 ;; but that's not feasible for the following reason: If we grow
1798 ;; the minibuffer window and the last window cannot be shrunk any
1799 ;; more, we shrink another window instead. But if we then shrink
1800 ;; the minibuffer window again, the last window might get enlarged
1801 ;; and the state after shrinking is not the state before growing.
1802 ;; So, in practice, we'd need a history variable to record how to
1803 ;; proceed. But I'm not sure how such a variable could work with
1804 ;; repeated minibuffer window growing steps.
1805 (resize-this-window window delta nil ignore t)
1806 delta)))
1807
1808(defsubst frame-root-window-p (window)
1809 "Return non-nil if WINDOW is the root window of its frame."
1810 (eq window (frame-root-window window)))
1811
1316;; This should probably return non-nil when the selected window is part 1812;; This should probably return non-nil when the selected window is part
1317;; of an atomic window whose root is the frame's root window. 1813;; of an atomic window whose root is the frame's root window.
1318(defun one-window-p (&optional nomini all-frames) 1814(defun one-window-p (&optional nomini all-frames)
@@ -1347,6 +1843,49 @@ and no others."
1347 (eq base-window 1843 (eq base-window
1348 (next-window base-window (if nomini 'arg) all-frames)))) 1844 (next-window base-window (if nomini 'arg) all-frames))))
1349 1845
1846;;; Deleting windows.
1847(defun window-deletable-p (&optional window)
1848 "Return t if WINDOW can be safely deleted from its frame.
1849Return `frame' if deleting WINDOW should delete its frame
1850instead."
1851 (setq window (normalize-any-window window))
1852 (unless ignore-window-parameters
1853 ;; Handle atomicity.
1854 (when (window-parameter window 'window-atom)
1855 (setq window (window-atom-root window))))
1856 (let ((parent (window-parent window))
1857 (frame (window-frame window))
1858 (dedicated (and (window-buffer window) (window-dedicated-p window)))
1859 (quit-restore (window-parameter window 'quit-restore)))
1860 (cond
1861 ((frame-root-window-p window)
1862 (when (and (or dedicated
1863 (and (eq (car-safe quit-restore) 'new-frame)
1864 (eq (nth 1 quit-restore) (window-buffer window))))
1865 (other-visible-frames-p frame))
1866 ;; WINDOW is the root window of its frame. Return `frame' but
1867 ;; only if WINDOW is (1) either dedicated or quit-restore's car
1868 ;; is new-frame and the window still displays the same buffer
1869 ;; and (2) there are other frames left.
1870 'frame))
1871 ((and (not ignore-window-parameters)
1872 (eq (window-parameter window 'window-side) 'none)
1873 (or (not parent)
1874 (not (eq (window-parameter parent 'window-side) 'none))))
1875 ;; Can't delete last main window.
1876 nil)
1877 (t))))
1878
1879(defun window-or-subwindow-p (subwindow window)
1880 "Return t if SUBWINDOW is either WINDOW or a subwindow of WINDOW."
1881 (or (eq subwindow window)
1882 (let ((parent (window-parent subwindow)))
1883 (catch 'done
1884 (while parent
1885 (if (eq parent window)
1886 (throw 'done t)
1887 (setq parent (window-parent parent))))))))
1888
1350;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 1889;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1351;;; `balance-windows' subroutines using `window-tree' 1890;;; `balance-windows' subroutines using `window-tree'
1352 1891