If I correctly recall the situation with temp-buffer-shrink-to-fit,
people wanted it to default to t but it was broken. Since I have now
added (well the patches might not be applied yet...) primitives to
allow doing this right for popper (customizable package implementing a
deluxe temp-buffer-shrink-to-fit behavior, a current version of which
will find its way into edit-utils shortly), I figured I'd take a quick
cut at fixing temp-buffer-shrink-to-fit. This probably needs a bit
more work - which is why I'm sending to xemacs-beta. For example
temp-buffer-max-height should probably be with respect to the window,
not the frame so as not to mess with multi-window configurations. Or
maybe it should only shrink the window if originally there was just a
single window. I'm not sure what the right thing is short of
re-creating all the popper functionality. But it basically does
correctly what the code had been trying to do. If someone wants to
hack on this more, go for it.
greg
1998-05-18 Greg Klanderman <greg(a)alphatech.com>
* frame.el (show-temp-buffer-in-current-frame):
fix for temp-buffer-shrink-to-fit non-nil.
Index: lisp/frame.el
===================================================================
RCS file: /usr/CVSroot/XEmacs/xemacs-20/lisp/frame.el,v
retrieving revision 1.15
diff -u -r1.15 frame.el
--- frame.el 1998/05/12 01:06:12 1.15
+++ frame.el 1998/05/19 08:09:05
@@ -1144,20 +1144,34 @@
that would otherwise be introduced by the `pre-display-buffer-function', which
is normally set to `get-frame-for-buffer' (which see)."
(let ((pre-display-buffer-function nil)) ; turn it off, whatever it is
- (let ((window (display-buffer buffer)))
- (if (not (eq (last-nonminibuf-frame) (window-frame window)))
+ (let* ((window (display-buffer buffer))
+ (frame (window-frame window)))
+ (if (not (eq (last-nonminibuf-frame) frame))
;; only the pre-display-buffer-function should ever do this.
(error "display-buffer switched frames on its own!!"))
(setq minibuffer-scroll-window window)
(set-window-start window 1) ; obeys narrowing
(set-window-point window 1)
(when temp-buffer-shrink-to-fit
- (let* ((temp-window-size (round (* temp-buffer-max-height
- (frame-height (window-frame window)))))
- (size (window-displayed-height window)))
- (when (< size temp-window-size)
- (enlarge-window (- temp-window-size size) nil window)))
- (shrink-window-if-larger-than-buffer window))
+ (let ((max-size (round (* temp-buffer-max-height
+ (frame-height frame))))
+ (size (window-height window)))
+ (when (< size max-size)
+ (enlarge-window (- max-size size) nil window))
+ (let ((shown (- (window-displayed-text-pixel-height window)
+ (if (and (> (point-max buffer) (point-min buffer))
+ (string= (buffer-substring
+ (1- (point-max buffer))
+ (point-max buffer)
+ buffer)
+ "\n"))
+ (face-height 'default window)
+ 0))))
+ (shrink-window-pixels
+ (- (window-text-area-pixel-height window)
+ (max shown (* (1- window-min-height) (face-height 'default
window))))
+ nil
+ window))))
nil)))
(setq pre-display-buffer-function 'get-frame-for-buffer)