changeset 1669:c5f86842283a

[xemacs-hg @ 2003-09-07 19:46:30 by adrian] [A21.5SR21.4] [PATCH] xemacs-21.5: Klaus Berndl's shrink-to-fit fix for `diplay-buffer' -------------------- ChangeLog entries follow: -------------------- lisp/ChangeLog addition: 2003-09-07 Adrian Aichner <adrian@xemacs.org> * window-xemacs.el (display-buffer): Fix for `shrink-to-fit' by Klaus Berndl, calling `shrink-window-if-larger-than-buffer' when displaying buffer in question.
author adrian
date Sun, 07 Sep 2003 19:46:32 +0000
parents 1e2c36d0f4e2
children e1d18dbb7692
files lisp/ChangeLog lisp/window-xemacs.el
diffstat 2 files changed, 19 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Sat Sep 06 21:52:21 2003 +0000
+++ b/lisp/ChangeLog	Sun Sep 07 19:46:32 2003 +0000
@@ -1,3 +1,9 @@
+2003-09-07  Adrian Aichner  <adrian@xemacs.org>
+
+	* window-xemacs.el (display-buffer): Fix for `shrink-to-fit' by
+	Klaus Berndl, calling `shrink-window-if-larger-than-buffer' when
+	displaying buffer in question.
+
 2003-09-03  Steve Youngs  <youngs@xemacs.org>
 
 	* XEmacs 21.5.15 "celery" is released.
--- a/lisp/window-xemacs.el	Sat Sep 06 21:52:21 2003 +0000
+++ b/lisp/window-xemacs.el	Sun Sep 07 19:46:32 2003 +0000
@@ -707,7 +707,7 @@
 	 ;; and does `returns' all over the place and there's no sense
 	 ;; in trying to rewrite it to be more Lispy.
 	 (catch 'done
-	   (let (window old-frame target-frame explicit-frame)
+	   (let (window old-frame target-frame explicit-frame shrink-it)
 	     (setq old-frame (or (last-nonminibuf-frame) (selected-frame)))
 	     (setq buffer (get-buffer buffer))
 	     (check-argument-type 'bufferp buffer)
@@ -895,9 +895,7 @@
 				(and (window-leftmost-p window)
 				     (window-rightmost-p window))))
 		       (setq window (split-window window))
-		     (let (upper
-;;			   lower
-			   other)
+		     (let (upper other)
 		       (setq window (get-lru-window target-frame))
 		       ;; If the LRU window is selected, and big enough,
 		       ;; and can be split, split it.
@@ -927,11 +925,9 @@
 		       ;; even out their heights.
 		       (if (window-previous-child window)
 			   (setq other (window-previous-child window)
-;;				 lower window
 				 upper other))
 		       (if (window-next-child window)
 			   (setq other (window-next-child window)
-;;				 lower other
 				 upper window))
 		       ;; Check that OTHER and WINDOW are vertically arrayed.
 		       (if (and other
@@ -944,8 +940,11 @@
 						 2)
 					      (window-height upper))
 					   nil upper))
-		       (if shrink-to-fit
-			   (shrink-window-if-larger-than-buffer window)))))
+                       ;; Klaus Berndl <klaus.berndl@sdm.de>: Only in
+                       ;; this situation we shrink-to-fit but we can do
+                       ;; this first after we have displayed buffer in
+                       ;; window (s.b. (set-window-buffer window buffer))
+                       (setq shrink-it shrink-to-fit))))
 
 	       (setq window (get-lru-window target-frame)))
 
@@ -958,6 +957,12 @@
 
 	     (set-window-buffer window buffer)
 
+             ;; Now window's previous buffer has been brought to the top
+             ;; of the MRU chain and window displays buffer - now we can
+             ;; shrink-to-fit if necessary
+             (if shrink-it
+                 (shrink-window-if-larger-than-buffer window))
+
 	     (display-buffer-1 window)))))
     (or (equal wconfig (current-window-configuration))
 	(push-window-configuration wconfig))