Subject: bug#16038: 24.3; latest change to with-help-window makes temp-buffer-browse useless

From: martin rudalics <[email-masked]>
Date: Sat, 11 Jan 2014 16:41:27 +0100

> with-output-to-temp-buffer usually are used to show useful text.
 > with-temp-buffer-window is sometimes used to show temporary text such as
 > used by dired to show a list of marked files.

IIRC my primary purpose writing `with-temp-buffer-window' was to get
`with-help-window' right and this does not necessarily show temporary
text.

 > Certainly I can put a hook
 > temp-buffer-window-show-hook but then I also need to opt out those
 > temporary cases.

You would have had to do this anyway: Earlier there was only
`with-output-to-temp-buffer' and so the marked files of dired would have
been shown with `with-output-to-temp-buffer' instead.  I suppose we use
`with-temp-buffer-window' now because this allows us to "quit" the
window easier.

 > And it seems temp-buffer-resize-mode is now
 > unnecessarily coupled with the window.el code, i.e. if we were to move
 > temp-buffer-resize-mode to a standalone package it won't work without
 > help from window.el.

`temp-buffer-resize-mode' which uses `resize-temp-buffer-window' is
still in help.el although it doesn't really belong there.  And
`resize-temp-buffer-window' calls `fit-window-to-buffer' which is
inherently tied to the window code.  So the core of
`temp-buffer-resize-mode' was with the window resizing code ever since.

 > The more interesting question is is it possible to merge these two
 > macros? For example, will it work if we can re-design the first argument
 > of with-output-to-temp-buffer to accept a list (BUFFER-OR-NAME ACTION
 > QUIT-FUNCTION) or an atom BUFFER-OR-NAME?

I'd rather get rid of `with-output-to-temp-buffer' ;-)

If you look into our mail archives, you should find a couple of
complaints about `with-output-to-temp-buffer' putting the buffer in
`help-mode' (via `temp-buffer-setup-hook') and the like.  I tried to
avoid these when I wrote `with-temp-buffer-window'.

Assume two applications A and B: A expects `with-output-to-temp-buffer'
to put the buffer in `help-mode'.  B wants to avoid that the buffer is
put in `help-mode'.  I can offer B to use `with-temp-buffer-window'
instead while A can continue to work as usual.  Eventually I'd like A to
use `with-temp-buffer-window' too and put the buffer in `help-mode'
itself.  But there were too many `with-output-to-temp-buffer' calls in
the code base and I was not able to look into them.

martin