# HG changeset patch # User michaels # Date 1042563291 0 # Node ID b724c5a1f7eaf36f130527cd52d33f89fd34e000 # Parent 02cf044d5fce8bb69b1ddc7817992bae98c934d6 [xemacs-hg @ 2003-01-14 16:54:50 by michaels] 2003-01-10 Mike Sperber * window-xemacs.el (window-reduce-to-one): Rewrite in terms of `delete-other-windows.' (window-find-buffer-subwindow): Add. diff -r 02cf044d5fce -r b724c5a1f7ea lisp/ChangeLog --- 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 + + * 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 * mule/japan-util.el (setup-japanese-environment-internal): diff -r 02cf044d5fce -r b724c5a1f7ea lisp/window-xemacs.el --- 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."