Subject: RE: bug#8358: 24.0.50; `minibuffer-scroll-window' with active minibuffer: always *Completions*?

From: "Drew Adams" <[email-masked]>
Date: Mon, 28 Mar 2011 06:44:55 -0700

> `with-output-to-temp-buffer' which displays the *Completions* buffer
> sets `minibuffer-scroll-window' to the window showing *Completions*.

Thanks for the info.  But why should that happen?  `with-output-to-temp-buffer'
is supposed to be general, for any temporary buffer.  It is not supposed to be
specific to *Completions* or *Help* or any other given temporary buffer.

And the doc of `scroll-other-window' says that "`minibuffer-scroll-window' if
non-nil specifies the window to scroll."  It doesn't say that it always
specifies the *Completions* window.

And the doc of `minibuffer-scroll-window' says "Non-nil means it is the window
that C-M-v in minibuffer should scroll."  It doesn't say that C-M-v in the
minibuffer always scrolls *Completions*.

There is nothing to indicate that things are in fact hard-coded so that the
window to scroll when you are in the minibuffer is always *Completions*.  And
there is nothing to indicate that that is the intention (design).

On the contrary.  This is a variable, created presumably to let you change the
window to be scrolled from the minibuffer.  And the doc supports this as the
intention.

> This happens _after_ running `completion-setup-hook' so your "foo"
> doesn't really do what you expected.
> 
> > Shouldn't you be able to set the window to be scrolled
> > (using `scroll-other-window') during minibuffer
> > input to be some window other than *Completions*?  How can 
> > I do that?
> 
> Try doing
> (add-hook 'temp-buffer-show-hook 'foo 'append)
> instead.  Or write your own `temp-buffer-show-function'.

Thanks, but such a workaround is a sledge hammer here.  `temp-buffer-show-hook'
is general, and it should not be necessary to add and remove stuff just to get
`minibuffer-scroll-window' to act as a variable.

I appreciate the implementation info, but this seems like a bug to me.
`minibuffer-scroll-window' is used only when the minibuffer is active, and it is
apparently always set, in that case, to the *Completions* window.  This was
created as a variable presumably so that programs could change the window to be
scrolled from the minibuffer.

It's not clear whether you are just explaining what currently happens (thank
you) or you are also saying that this is not a bug.  What's the point of
`minibuffer-scroll-window' if it is always effectively *Completions*?

Other than this hard-coded case, user code has easy control over
`scroll-other-window(-down)'.  Can we please fix this so that
`minibuffer-scroll-window' acts as advertised?