diff lisp/window-xemacs.el @ 1230:78781398fc4c

[xemacs-hg @ 2003-01-23 10:09:41 by michaels] 2003-01-10 Mike Sperber <mike@xemacs.org> * window-xemacs.el: Revert his change 2003-01-10 Mike Sperber <mike@xemacs.org> * window-xemacs.el (window-reduce-to-one): Rewrite in terms of `delete-other-windows.' (window-find-buffer-subwindow): Add. It caused subtle breakage. (And add a comment to that effect.)
author michaels
date Thu, 23 Jan 2003 10:09:41 +0000
parents b724c5a1f7ea
children 465bd3c7d932
line wrap: on
line diff
--- a/lisp/window-xemacs.el	Thu Jan 23 02:16:42 2003 +0000
+++ b/lisp/window-xemacs.el	Thu Jan 23 10:09:41 2003 +0000
@@ -325,18 +325,22 @@
     (if combination-start
 	(window-reduce-to-one combination-start))))
 
+;; Note that simply using `delete-other-windows' causes obscure
+;; breakage. --Mike
+
 (defun window-reduce-to-one (window)
   "Make sure only one subwindow of WINDOW is left."
-  (let ((buffer-window (window-find-buffer-subwindow window)))
-    (delete-other-windows buffer-window)))
-
-(defun window-find-buffer-subwindow (window)
-  "Find a subwindow of window which contains a buffer."
-  (while (not (window-buffer window))
-    (if (window-first-vchild window)
-	(setq window (window-first-vchild window))
-      (setq window (window-first-hchild window))))
-  window)
+  (let ((window (window-next-child window)))
+    (while window
+      (if (window-live-p window)
+	  (let ((next (window-next-child window)))
+	    (delete-window window)
+	    (setq window next)))))
+  (cond
+   ((window-first-hchild window)
+    (window-reduce-to-one (window-first-hchild window)))
+   ((window-first-vchild window)
+    (window-reduce-to-one (window-first-vchild window)))))
 
 (defun restore-saved-window (configuration window saved-window direction)
   "Within CONFIGURATION, restore WINDOW to the state of SAVED-WINDOW."