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

From: "Drew Adams" <[email-masked]>
Date: Mon, 3 Nov 2008 00:21:18 -0800

> FAIK the *Completions* windows and the minibuffer are independent from
> each other.  So we have to find a mechanism to tell the window
> management part what to do.  Fixing window sizes in some "lax" fashion
> is one way to do that.

AFAIK, the main functions that complete minibuffer input and display possible
completions use buffer *Completions* for that display.
`minibuffer-completion-help' and `switch-to-completions', for example, are used
by the standard minibuffer completion keymaps, and they both use *Completions*.
Likewise, Pcomplete and Iswitchb use *Completions*. Ido uses the value of
`ido-completion-buffer', however.

Seems a good enough heuristic that for minibuffer completion the completions are
displayed in a window showing buffer *Completions*, if they are displayed at all
(`completion-show-help'). Not 100% fail-safe, perhaps, but it should be possible
to nail things down pretty well, if necessary, to make sure that a displayed
*Completions* buffer in `completion-list-mode' is showing the current
completions for the active minibuffer currently completing.

In practice, I don't think such nails are really needed. Both
`minibuffer-completion-help' and `switch-to-completions' simply rely on
(get-buffer-window "*Completions*"), and that seems to suffice to determine the
completions window. However, I suggest using 0 for the FRAME arg to
`get-buffer-window', since *Completions* might be on a different frame from the
minibuffer (e.g. standalone minibuffer, special-display *Completions*).

So I guess I don't see the independence you mention. During minibuffer
completion, a visible window showing buffer *Completions* is the one whose size
the minibuffer should care about. If there is no such window, e.g. because the
completions buffer has a different name, then the minibuffer won't take the
completions window into account for its resizing - but in that corner case we
are no worse off than now.

In sum, if *Completions* is visible during minibuffer completion, then the
minibuffer should take its window into account. If not, it need not worry about
it.