aboutsummaryrefslogtreecommitdiffstats
path: root/src/window.c
diff options
context:
space:
mode:
authorGerd Moellmann2000-07-06 14:18:36 +0000
committerGerd Moellmann2000-07-06 14:18:36 +0000
commit118ea2426343bea2a8006d689494a92bf08fb61c (patch)
treebc0f66d00c3fdfe11c45743d22f1b341a899fcd6 /src/window.c
parent7e6cb5132d09bedb16701bde1a93b0053f403762 (diff)
downloademacs-118ea2426343bea2a8006d689494a92bf08fb61c.tar.gz
emacs-118ea2426343bea2a8006d689494a92bf08fb61c.zip
(Fwindow_list): Reverse list at the end.
(candidate_window_p): Add parameter OWINDOW. ALL_FRAMES nil means allow windows on OWINDOW's frame, only. (window_loop): Simplified; use Fwindow_list.
Diffstat (limited to 'src/window.c')
-rw-r--r--src/window.c276
1 files changed, 132 insertions, 144 deletions
diff --git a/src/window.c b/src/window.c
index c0b99f735cd..50f7238205f 100644
--- a/src/window.c
+++ b/src/window.c
@@ -69,7 +69,8 @@ static int window_fixed_size_p P_ ((struct window *, int, int));
69static void enlarge_window P_ ((Lisp_Object, int, int)); 69static void enlarge_window P_ ((Lisp_Object, int, int));
70static Lisp_Object window_list P_ ((void)); 70static Lisp_Object window_list P_ ((void));
71static int add_window_to_list P_ ((struct window *, Lisp_Object *)); 71static int add_window_to_list P_ ((struct window *, Lisp_Object *));
72static int candidate_window_p P_ ((Lisp_Object, Lisp_Object, Lisp_Object)); 72static int candidate_window_p P_ ((Lisp_Object, Lisp_Object, Lisp_Object,
73 Lisp_Object));
73static Lisp_Object next_window P_ ((Lisp_Object, Lisp_Object, 74static Lisp_Object next_window P_ ((Lisp_Object, Lisp_Object,
74 Lisp_Object, int)); 75 Lisp_Object, int));
75static void decode_next_window_args P_ ((Lisp_Object *, Lisp_Object *, 76static void decode_next_window_args P_ ((Lisp_Object *, Lisp_Object *,
@@ -1226,24 +1227,23 @@ window_list ()
1226} 1227}
1227 1228
1228 1229
1229/* Value is non-zero if WINODW satisfies the constraints given by 1230/* Value is non-zero if WINDOW satisfies the constraints given by
1230 MINIBUF and ALL_FRAMES. 1231 OWINDOW, MINIBUF and ALL_FRAMES.
1231 1232
1232 MINIBUF t means WINDOW may be a minibuffer window. 1233 MINIBUF t means WINDOW may be minibuffer windows.
1233 MINIBUF `lambda' means it may not be a minibuffer window. 1234 `lambda' means WINDOW may not be a minibuffer window.
1234 MINIBUF being a window means WINDOW must be equal to MINIBUF. 1235 a window means a specific minibuffer window
1235 1236
1236 ALL_FRAMES t means WINDOW may be on any frame. 1237 ALL_FRAMES t means search all frames,
1237 ALL_FRAMES nil means WINDOW must not be on a minibuffer-only frame. 1238 nil means search just current frame,
1238 ALL_FRAMES `visible' means WINDOW must be on a visible frame. 1239 `visible' means search just visible frames,
1239 ALL_FRAMES 0 means WINDOW must be on a visible or iconified frame. 1240 0 means search visible and iconified frames,
1240 ALL_FRAMES being a frame means WINDOW must be on that frame. 1241 a window means search the frame that window belongs to,
1241 ALL_FRAMES being a window means WINDOW must be on a frame using 1242 a frame means consider windows on that frame, only. */
1242 the same minibuffer as ALL_FRAMES. */
1243 1243
1244static int 1244static int
1245candidate_window_p (window, minibuf, all_frames) 1245candidate_window_p (window, owindow, minibuf, all_frames)
1246 Lisp_Object window, minibuf, all_frames; 1246 Lisp_Object window, owindow, minibuf, all_frames;
1247{ 1247{
1248 struct window *w = XWINDOW (window); 1248 struct window *w = XWINDOW (window);
1249 struct frame *f = XFRAME (w->frame); 1249 struct frame *f = XFRAME (w->frame);
@@ -1259,8 +1259,13 @@ candidate_window_p (window, minibuf, all_frames)
1259 If it is a window, consider only that one. */ 1259 If it is a window, consider only that one. */
1260 candidate_p = 0; 1260 candidate_p = 0;
1261 } 1261 }
1262 else if (EQ (all_frames, Qt))
1263 candidate_p = 1;
1262 else if (NILP (all_frames)) 1264 else if (NILP (all_frames))
1263 candidate_p = !FRAME_MINIBUF_ONLY_P (f); 1265 {
1266 xassert (WINDOWP (owindow));
1267 candidate_p = EQ (w->frame, XWINDOW (owindow)->frame);
1268 }
1264 else if (EQ (all_frames, Qvisible)) 1269 else if (EQ (all_frames, Qvisible))
1265 { 1270 {
1266 FRAME_SAMPLE_VISIBILITY (f); 1271 FRAME_SAMPLE_VISIBILITY (f);
@@ -1271,12 +1276,12 @@ candidate_window_p (window, minibuf, all_frames)
1271 FRAME_SAMPLE_VISIBILITY (f); 1276 FRAME_SAMPLE_VISIBILITY (f);
1272 candidate_p = FRAME_VISIBLE_P (f) || FRAME_ICONIFIED_P (f); 1277 candidate_p = FRAME_VISIBLE_P (f) || FRAME_ICONIFIED_P (f);
1273 } 1278 }
1274 else if (FRAMEP (all_frames))
1275 candidate_p = EQ (all_frames, w->frame);
1276 else if (WINDOWP (all_frames)) 1279 else if (WINDOWP (all_frames))
1277 candidate_p = (EQ (FRAME_MINIBUF_WINDOW (f), all_frames) 1280 candidate_p = (EQ (FRAME_MINIBUF_WINDOW (f), all_frames)
1278 || EQ (XWINDOW (all_frames)->frame, w->frame) 1281 || EQ (XWINDOW (all_frames)->frame, w->frame)
1279 || EQ (XWINDOW (all_frames)->frame, FRAME_FOCUS_FRAME (f))); 1282 || EQ (XWINDOW (all_frames)->frame, FRAME_FOCUS_FRAME (f)));
1283 else if (FRAMEP (all_frames))
1284 candidate_p = EQ (all_frames, w->frame);
1280 1285
1281 return candidate_p; 1286 return candidate_p;
1282} 1287}
@@ -1356,7 +1361,7 @@ next_window (window, minibuf, all_frames, next_p)
1356 /* Scan forward from WINDOW to the end of the window list. */ 1361 /* Scan forward from WINDOW to the end of the window list. */
1357 if (CONSP (list)) 1362 if (CONSP (list))
1358 for (list = XCDR (list); CONSP (list); list = XCDR (list)) 1363 for (list = XCDR (list); CONSP (list); list = XCDR (list))
1359 if (candidate_window_p (XCAR (list), minibuf, all_frames)) 1364 if (candidate_window_p (XCAR (list), window, minibuf, all_frames))
1360 break; 1365 break;
1361 1366
1362 /* Scan from the start of the window list up to WINDOW. */ 1367 /* Scan from the start of the window list up to WINDOW. */
@@ -1364,7 +1369,7 @@ next_window (window, minibuf, all_frames, next_p)
1364 for (list = Vwindow_list; 1369 for (list = Vwindow_list;
1365 CONSP (list) && !EQ (XCAR (list), window); 1370 CONSP (list) && !EQ (XCAR (list), window);
1366 list = XCDR (list)) 1371 list = XCDR (list))
1367 if (candidate_window_p (XCAR (list), minibuf, all_frames)) 1372 if (candidate_window_p (XCAR (list), window, minibuf, all_frames))
1368 break; 1373 break;
1369 1374
1370 if (CONSP (list)) 1375 if (CONSP (list))
@@ -1386,7 +1391,8 @@ next_window (window, minibuf, all_frames, next_p)
1386 if (WINDOWP (candidate)) 1391 if (WINDOWP (candidate))
1387 break; 1392 break;
1388 } 1393 }
1389 else if (candidate_window_p (XCAR (list), minibuf, all_frames)) 1394 else if (candidate_window_p (XCAR (list), window, minibuf,
1395 all_frames))
1390 candidate = XCAR (list); 1396 candidate = XCAR (list);
1391 } 1397 }
1392 1398
@@ -1507,7 +1513,7 @@ argument ALL_FRAMES is non-nil, cycle through all frames.")
1507 1513
1508 1514
1509DEFUN ("window-list", Fwindow_list, Swindow_list, 0, 3, 0, 1515DEFUN ("window-list", Fwindow_list, Swindow_list, 0, 3, 0,
1510 "Return a list windows in canonical ordering.\n\ 1516 "Return a list of windows in canonical ordering.\n\
1511Arguments are like for `next-window'.") 1517Arguments are like for `next-window'.")
1512 (window, minibuf, all_frames) 1518 (window, minibuf, all_frames)
1513 Lisp_Object minibuf, all_frames; 1519 Lisp_Object minibuf, all_frames;
@@ -1518,10 +1524,10 @@ Arguments are like for `next-window'.")
1518 list = Qnil; 1524 list = Qnil;
1519 1525
1520 for (tail = window_list (); CONSP (tail); tail = XCDR (tail)) 1526 for (tail = window_list (); CONSP (tail); tail = XCDR (tail))
1521 if (candidate_window_p (XCAR (tail), minibuf, all_frames)) 1527 if (candidate_window_p (XCAR (tail), window, minibuf, all_frames))
1522 list = Fcons (XCAR (tail), list); 1528 list = Fcons (XCAR (tail), list);
1523 1529
1524 return list; 1530 return Fnreverse (list);
1525} 1531}
1526 1532
1527 1533
@@ -1550,32 +1556,30 @@ enum window_loop
1550static Lisp_Object 1556static Lisp_Object
1551window_loop (type, obj, mini, frames) 1557window_loop (type, obj, mini, frames)
1552 enum window_loop type; 1558 enum window_loop type;
1553 register Lisp_Object obj, frames; 1559 Lisp_Object obj, frames;
1554 int mini; 1560 int mini;
1555{ 1561{
1556 register Lisp_Object w; 1562 Lisp_Object window, windows, best_window, frame_arg;
1557 register Lisp_Object best_window; 1563 struct frame *f;
1558 register Lisp_Object next_window; 1564
1559 register Lisp_Object last_window;
1560 FRAME_PTR frame;
1561 Lisp_Object frame_arg;
1562 frame_arg = Qt;
1563
1564 /* If we're only looping through windows on a particular frame, 1565 /* If we're only looping through windows on a particular frame,
1565 frame points to that frame. If we're looping through windows 1566 frame points to that frame. If we're looping through windows
1566 on all frames, frame is 0. */ 1567 on all frames, frame is 0. */
1567 if (FRAMEP (frames)) 1568 if (FRAMEP (frames))
1568 frame = XFRAME (frames); 1569 f = XFRAME (frames);
1569 else if (NILP (frames)) 1570 else if (NILP (frames))
1570 frame = SELECTED_FRAME (); 1571 f = SELECTED_FRAME ();
1571 else 1572 else
1572 frame = 0; 1573 f = NULL;
1573 if (frame) 1574
1575 if (f)
1574 frame_arg = Qlambda; 1576 frame_arg = Qlambda;
1575 else if (XFASTINT (frames) == 0) 1577 else if (XFASTINT (frames) == 0)
1576 frame_arg = frames; 1578 frame_arg = frames;
1577 else if (EQ (frames, Qvisible)) 1579 else if (EQ (frames, Qvisible))
1578 frame_arg = frames; 1580 frame_arg = frames;
1581 else
1582 frame_arg = Qt;
1579 1583
1580 /* frame_arg is Qlambda to stick to one frame, 1584 /* frame_arg is Qlambda to stick to one frame,
1581 Qvisible to consider all visible frames, 1585 Qvisible to consider all visible frames,
@@ -1583,11 +1587,11 @@ window_loop (type, obj, mini, frames)
1583 1587
1584 /* Pick a window to start with. */ 1588 /* Pick a window to start with. */
1585 if (WINDOWP (obj)) 1589 if (WINDOWP (obj))
1586 w = obj; 1590 window = obj;
1587 else if (frame) 1591 else if (f)
1588 w = FRAME_SELECTED_WINDOW (frame); 1592 window = FRAME_SELECTED_WINDOW (f);
1589 else 1593 else
1590 w = FRAME_SELECTED_WINDOW (SELECTED_FRAME ()); 1594 window = FRAME_SELECTED_WINDOW (SELECTED_FRAME ());
1591 1595
1592 /* Figure out the last window we're going to mess with. Since 1596 /* Figure out the last window we're going to mess with. Since
1593 Fnext_window, given the same options, is guaranteed to go in a 1597 Fnext_window, given the same options, is guaranteed to go in a
@@ -1596,178 +1600,162 @@ window_loop (type, obj, mini, frames)
1596 We can't just wait until we hit the first window again, because 1600 We can't just wait until we hit the first window again, because
1597 it might be deleted. */ 1601 it might be deleted. */
1598 1602
1599 last_window = Fprevious_window (w, mini ? Qt : Qnil, frame_arg); 1603 windows = Fwindow_list (window, mini ? Qt : Qnil, frame_arg);
1600 1604 GCPRO1 (windows);
1601 best_window = Qnil; 1605 best_window = Qnil;
1602 for (;;) 1606
1607 for (; CONSP (windows); windows = CDR (windows))
1603 { 1608 {
1604 /* Pick the next window now, since some operations will delete 1609 struct window *w;
1605 the current window. */ 1610
1606 next_window = Fnext_window (w, mini ? Qt : Qnil, frame_arg); 1611 window = XCAR (windows);
1607 1612 w = XWINDOW (window);
1608 /* Note that we do not pay attention here to whether 1613
1609 the frame is visible, since Fnext_window skips non-visible frames 1614 /* Note that we do not pay attention here to whether the frame
1610 if that is desired, under the control of frame_arg. */ 1615 is visible, since Fwindow_list skips non-visible frames if
1611 if (! MINI_WINDOW_P (XWINDOW (w)) 1616 that is desired, under the control of frame_arg. */
1617 if (!MINI_WINDOW_P (w)
1612 /* For UNSHOW_BUFFER, we must always consider all windows. */ 1618 /* For UNSHOW_BUFFER, we must always consider all windows. */
1613 || type == UNSHOW_BUFFER 1619 || type == UNSHOW_BUFFER
1614 || (mini && minibuf_level > 0)) 1620 || (mini && minibuf_level > 0))
1615 switch (type) 1621 switch (type)
1616 { 1622 {
1617 case GET_BUFFER_WINDOW: 1623 case GET_BUFFER_WINDOW:
1618 if (XBUFFER (XWINDOW (w)->buffer) == XBUFFER (obj) 1624 if (EQ (w->buffer, obj)
1619 /* Don't find any minibuffer window 1625 /* Don't find any minibuffer window
1620 except the one that is currently in use. */ 1626 except the one that is currently in use. */
1621 && (MINI_WINDOW_P (XWINDOW (w)) 1627 && (MINI_WINDOW_P (w)
1622 ? EQ (w, minibuf_window) : 1)) 1628 ? EQ (window, minibuf_window)
1623 return w; 1629 : 1))
1630 {
1631 UNGCPRO;
1632 return window;
1633 }
1624 break; 1634 break;
1625 1635
1626 case GET_LRU_WINDOW: 1636 case GET_LRU_WINDOW:
1627 /* t as arg means consider only full-width windows */ 1637 /* t as arg means consider only full-width windows */
1628 if (!NILP (obj) && !WINDOW_FULL_WIDTH_P (XWINDOW (w))) 1638 if (!NILP (obj) && !WINDOW_FULL_WIDTH_P (w))
1629 break; 1639 break;
1630 /* Ignore dedicated windows and minibuffers. */ 1640 /* Ignore dedicated windows and minibuffers. */
1631 if (MINI_WINDOW_P (XWINDOW (w)) 1641 if (MINI_WINDOW_P (w) || !NILP (w->dedicated))
1632 || !NILP (XWINDOW (w)->dedicated))
1633 break; 1642 break;
1634 if (NILP (best_window) 1643 if (NILP (best_window)
1635 || (XFASTINT (XWINDOW (best_window)->use_time) 1644 || (XFASTINT (XWINDOW (best_window)->use_time)
1636 > XFASTINT (XWINDOW (w)->use_time))) 1645 > XFASTINT (w->use_time)))
1637 best_window = w; 1646 best_window = window;
1638 break; 1647 break;
1639 1648
1640 case DELETE_OTHER_WINDOWS: 1649 case DELETE_OTHER_WINDOWS:
1641 if (XWINDOW (w) != XWINDOW (obj)) 1650 if (!EQ (window, obj))
1642 Fdelete_window (w); 1651 Fdelete_window (window);
1643 break; 1652 break;
1644 1653
1645 case DELETE_BUFFER_WINDOWS: 1654 case DELETE_BUFFER_WINDOWS:
1646 if (EQ (XWINDOW (w)->buffer, obj)) 1655 if (EQ (w->buffer, obj))
1647 { 1656 {
1648 FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (w))); 1657 struct frame *f = XFRAME (WINDOW_FRAME (w));
1649 1658
1650 /* If this window is dedicated, and in a frame of its own, 1659 /* If this window is dedicated, and in a frame of its own,
1651 kill the frame. */ 1660 kill the frame. */
1652 if (EQ (w, FRAME_ROOT_WINDOW (f)) 1661 if (EQ (window, FRAME_ROOT_WINDOW (f))
1653 && !NILP (XWINDOW (w)->dedicated) 1662 && !NILP (w->dedicated)
1654 && other_visible_frames (f)) 1663 && other_visible_frames (f))
1655 { 1664 {
1656 /* Skip the other windows on this frame. 1665 /* Skip the other windows on this frame.
1657 There might be one, the minibuffer! */ 1666 There might be one, the minibuffer! */
1658 if (! EQ (w, last_window)) 1667 while (CONSP (XCDR (windows))
1659 while (f == XFRAME (WINDOW_FRAME (XWINDOW (next_window)))) 1668 && EQ (XWINDOW (XCAR (windows))->frame,
1660 { 1669 XWINDOW (XCAR (XCDR (windows)))->frame))
1661 /* As we go, check for the end of the loop. 1670 windows = XCDR (windows);
1662 We mustn't start going around a second time. */ 1671
1663 if (EQ (next_window, last_window))
1664 {
1665 last_window = w;
1666 break;
1667 }
1668 next_window = Fnext_window (next_window,
1669 mini ? Qt : Qnil,
1670 frame_arg);
1671 }
1672 /* Now we can safely delete the frame. */ 1672 /* Now we can safely delete the frame. */
1673 Fdelete_frame (WINDOW_FRAME (XWINDOW (w)), Qnil); 1673 Fdelete_frame (w->frame, Qnil);
1674 }
1675 else if (NILP (w->parent))
1676 {
1677 /* If we're deleting the buffer displayed in the
1678 only window on the frame, find a new buffer to
1679 display there. */
1680 Lisp_Object buffer;
1681 buffer = Fother_buffer (obj, Qnil, w->frame);
1682 if (NILP (buffer))
1683 buffer = Fget_buffer_create (build_string ("*scratch*"));
1684 Fset_window_buffer (window, buffer);
1685 if (EQ (window, selected_window))
1686 Fset_buffer (w->buffer);
1674 } 1687 }
1675 else 1688 else
1676 /* If we're deleting the buffer displayed in the only window 1689 Fdelete_window (window);
1677 on the frame, find a new buffer to display there. */
1678 if (NILP (XWINDOW (w)->parent))
1679 {
1680 Lisp_Object new_buffer;
1681 new_buffer = Fother_buffer (obj, Qnil,
1682 XWINDOW (w)->frame);
1683 if (NILP (new_buffer))
1684 new_buffer
1685 = Fget_buffer_create (build_string ("*scratch*"));
1686 Fset_window_buffer (w, new_buffer);
1687 if (EQ (w, selected_window))
1688 Fset_buffer (XWINDOW (w)->buffer);
1689 }
1690 else
1691 Fdelete_window (w);
1692 } 1690 }
1693 break; 1691 break;
1694 1692
1695 case GET_LARGEST_WINDOW: 1693 case GET_LARGEST_WINDOW:
1696 /* Ignore dedicated windows and minibuffers. */
1697 if (MINI_WINDOW_P (XWINDOW (w))
1698 || !NILP (XWINDOW (w)->dedicated)
1699 || NILP (best_window))
1700 break;
1701 { 1694 {
1702 struct window *best_window_ptr = XWINDOW (best_window); 1695 struct window *b;
1703 struct window *w_ptr = XWINDOW (w); 1696
1697 /* Ignore dedicated windows and minibuffers. */
1698 if (MINI_WINDOW_P (w)
1699 || !NILP (w->dedicated)
1700 || NILP (best_window))
1701 break;
1702
1703 b = XWINDOW (best_window);
1704 if (NILP (best_window) 1704 if (NILP (best_window)
1705 || (XFASTINT (w_ptr->height) * XFASTINT (w_ptr->width) 1705 || (XFASTINT (w->height) * XFASTINT (w->width)
1706 > (XFASTINT (best_window_ptr->height) 1706 > (XFASTINT (b->height) * XFASTINT (b->width))))
1707 * XFASTINT (best_window_ptr->width)))) 1707 best_window = window;
1708 best_window = w;
1709 } 1708 }
1710 break; 1709 break;
1711 1710
1712 case UNSHOW_BUFFER: 1711 case UNSHOW_BUFFER:
1713 if (EQ (XWINDOW (w)->buffer, obj)) 1712 if (EQ (w->buffer, obj))
1714 { 1713 {
1714 Lisp_Object buffer;
1715 struct frame *f = XFRAME (w->frame);
1716
1715 /* Find another buffer to show in this window. */ 1717 /* Find another buffer to show in this window. */
1716 Lisp_Object another_buffer; 1718 buffer = Fother_buffer (obj, Qnil, w->frame);
1717 FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (w))); 1719 if (NILP (buffer))
1718 another_buffer = Fother_buffer (obj, Qnil, XWINDOW (w)->frame); 1720 buffer = Fget_buffer_create (build_string ("*scratch*"));
1719 if (NILP (another_buffer)) 1721
1720 another_buffer
1721 = Fget_buffer_create (build_string ("*scratch*"));
1722 /* If this window is dedicated, and in a frame of its own, 1722 /* If this window is dedicated, and in a frame of its own,
1723 kill the frame. */ 1723 kill the frame. */
1724 if (EQ (w, FRAME_ROOT_WINDOW (f)) 1724 if (EQ (window, FRAME_ROOT_WINDOW (f))
1725 && !NILP (XWINDOW (w)->dedicated) 1725 && !NILP (w->dedicated)
1726 && other_visible_frames (f)) 1726 && other_visible_frames (f))
1727 { 1727 {
1728 /* Skip the other windows on this frame. 1728 /* Skip the other windows on this frame.
1729 There might be one, the minibuffer! */ 1729 There might be one, the minibuffer! */
1730 if (! EQ (w, last_window)) 1730 while (CONSP (XCDR (windows))
1731 while (f == XFRAME (WINDOW_FRAME (XWINDOW (next_window)))) 1731 && EQ (XWINDOW (XCAR (windows))->frame,
1732 { 1732 XWINDOW (XCAR (XCDR (windows)))->frame))
1733 /* As we go, check for the end of the loop. 1733 windows = XCDR (windows);
1734 We mustn't start going around a second time. */ 1734
1735 if (EQ (next_window, last_window))
1736 {
1737 last_window = w;
1738 break;
1739 }
1740 next_window = Fnext_window (next_window,
1741 mini ? Qt : Qnil,
1742 frame_arg);
1743 }
1744 /* Now we can safely delete the frame. */ 1735 /* Now we can safely delete the frame. */
1745 Fdelete_frame (WINDOW_FRAME (XWINDOW (w)), Qnil); 1736 Fdelete_frame (w->frame, Qnil);
1746 } 1737 }
1747 else 1738 else
1748 { 1739 {
1749 /* Otherwise show a different buffer in the window. */ 1740 /* Otherwise show a different buffer in the window. */
1750 XWINDOW (w)->dedicated = Qnil; 1741 w->dedicated = Qnil;
1751 Fset_window_buffer (w, another_buffer); 1742 Fset_window_buffer (window, buffer);
1752 if (EQ (w, selected_window)) 1743 if (EQ (window, selected_window))
1753 Fset_buffer (XWINDOW (w)->buffer); 1744 Fset_buffer (w->buffer);
1754 } 1745 }
1755 } 1746 }
1756 break; 1747 break;
1757 1748
1758 /* Check for a window that has a killed buffer. */ 1749 /* Check for a window that has a killed buffer. */
1759 case CHECK_ALL_WINDOWS: 1750 case CHECK_ALL_WINDOWS:
1760 if (! NILP (XWINDOW (w)->buffer) 1751 if (! NILP (w->buffer)
1761 && NILP (XBUFFER (XWINDOW (w)->buffer)->name)) 1752 && NILP (XBUFFER (w->buffer)->name))
1762 abort (); 1753 abort ();
1754 break;
1763 } 1755 }
1764
1765 if (EQ (w, last_window))
1766 break;
1767
1768 w = next_window;
1769 } 1756 }
1770 1757
1758 UNGCPRO;
1771 return best_window; 1759 return best_window;
1772} 1760}
1773 1761