changeset 1208:b724c5a1f7ea

[xemacs-hg @ 2003-01-14 16:54:50 by michaels] 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.
author michaels
date Tue, 14 Jan 2003 16:54:51 +0000
parents 02cf044d5fce
children 289d437268df
files lisp/ChangeLog lisp/window-xemacs.el
diffstat 2 files changed, 16 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Tue Jan 14 16:54:03 2003 +0000
+++ b/lisp/ChangeLog	Tue Jan 14 16:54:51 2003 +0000
@@ -1,3 +1,9 @@
+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.
+
 2003-01-09  Stephen J. Turnbull  <stephen@xemacs.org>
 
 	* mule/japan-util.el (setup-japanese-environment-internal):
--- a/lisp/window-xemacs.el	Tue Jan 14 16:54:03 2003 +0000
+++ b/lisp/window-xemacs.el	Tue Jan 14 16:54:51 2003 +0000
@@ -327,17 +327,16 @@
 
 (defun window-reduce-to-one (window)
   "Make sure only one subwindow of WINDOW is left."
-  (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)))))
+  (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)
 
 (defun restore-saved-window (configuration window saved-window direction)
   "Within CONFIGURATION, restore WINDOW to the state of SAVED-WINDOW."