Subject: bug#1488: 23.0.60; dired-pop-to-buffer: use fit-window-to-buffer

From: martin rudalics <[email-masked]>
Date: Fri, 05 Dec 2008 15:25:04 +0100

Stephen,

`fit-window-to-buffer' seems broken in a number of regards.  I'll
eventually put condition-cases around the `enlarge-window' calls.
Could you, so far, try whether the attached patch improves things.

Thanks, martin.
*** window.el.~1.169.~	2008-11-27 11:14:14.671875000 +0100
--- window.el	2008-12-05 15:22:20.281250000 +0100
***************
*** 1307,1313 ****
    (when (null window)
      (setq window (selected-window)))
    (when (null max-height)
!     (setq max-height (frame-height (window-frame window))))
  
    (let* ((buf
  	  ;; Buffer that is displayed in WINDOW
--- 1307,1313 ----
    (when (null window)
      (setq window (selected-window)))
    (when (null max-height)
!     (setq max-height (- (frame-height (window-frame window)) 1)))
  
    (let* ((buf
  	  ;; Buffer that is displayed in WINDOW
***************
*** 1334,1341 ****
  	 (delta
  	  ;; Calculate how much the window height has to change to show
  	  ;; desired-height lines, constrained by MIN-HEIGHT and MAX-HEIGHT.
! 	  (- (max (min desired-height max-height)
! 		  (or min-height window-min-height))
  	     window-height)))
  
      ;; Don't try to redisplay with the cursor at the end
--- 1334,1341 ----
  	 (delta
  	  ;; Calculate how much the window height has to change to show
  	  ;; desired-height lines, constrained by MIN-HEIGHT and MAX-HEIGHT.
! 	  (- (min max-height
! 		  (max desired-height (or min-height window-min-height)))
  	     window-height)))
  
      ;; Don't try to redisplay with the cursor at the end