Subject: bug#1291: 23.0.60; 1) resize-mini-windows: customizable, 2) if grow mini, grow Completions

From: "Drew Adams" <[email-masked]>
Date: Sun, 2 Nov 2008 11:05:35 -0800

> From: martin rudalics Sent: Sunday, November 02, 2008 10:15 AM
>  > Previously (2008-10-09 build), the *Completions* buffer 
>  > showed all of the candidates through `s==>Subdir', e.g.
>  > when I try it in a Dired buffer. It only left out one line,
>  > with the candidate `h==>Help'. Now, *Completions* leaves out
>  > all of these candidates:
> 
> I'm afraid we won't get this very right ever.  But you could try the
> below version of `Electric-pop-up-window'.
> 
> martin
> 
> (defun Electric-pop-up-window (buffer &optional max-height)
>    (let* ((win (or (get-buffer-window buffer) (selected-window)))
> 	 (buf (get-buffer buffer))
> 	 (one-window (one-window-p t))
> 	 (pop-up-windows t)
> 	 (pop-up-frames nil))
>      (if (not buf)
> 	(error "Buffer %s does not exist" buffer)
>        (cond ((and (eq (window-buffer win) buf))
> 	     (select-window win))
> 	    (one-window
> 	     (pop-to-buffer buffer)
> 	     (setq win (selected-window)))
> 	    (t
> 	     (switch-to-buffer buf)))
>        ;; Don't shrink the window, but expand it if necessary.
>        (goto-char (point-min))
>        (unless (<= (point-max) (window-end win t))
> 	(fit-window-to-buffer win max-height))
>        win)))

That seems to give the same behavior as the build of 2008-10-09: The last line
is still not included in the *Completions* window. 

The problem is not that the *Completions* window is not fit properly by
Electric-pop-up-window - it is. The problem is that after fitting it the
minibuffer expansion reduces the *Completions* window. It should not.

There ought to be a way to respect the *Completions* window size that we go to
the trouble of creating by calling `fit-window-to-buffer'.