Subject: Re: bug#11939: 24.1; `save-buffers-kill-emacs' losesminibufferfocuswhenitcalls`list-processes'

From: martin rudalics <[email-masked]>
Date: Sat, 11 Aug 2012 11:31:18 +0200

> BTW: Do you not think that there should be a call to `raise-frame' in `s-d-p-f'
 > before returning the WINDOW in the case where ARGS is a list (FUNCTION .
 > FN-ARGS)?
 >
 > Should it not _always_ be the case that `special-display-popup-frame' pops up
 > the buffer in a frame, i.e., ensures that its display is clearly visible?

Its doc-string says: "If ARGS is a list whose car is a symbol, use (car
ARGS) as a function to do the work."  I suppose that "do the work" means
that function is entirely responsible for doing what you want.  In any
other case, `special-display-popup-frame' should do what you want.

 > Even if the buffer is already displayed somewhere, shouldn't a frame that it is
 > displayed in be raised?

`special-display-popup-frame' does that when it finds a window
displaying the buffer.

 > In particular, the frame that is the `window-frame' of
 > the window returned by FUNCTION applied to its args?

I suppose FUNCTION should be held responsible for raising the frame if
needed.

 > NOTE: If the frame fitting did not need to be done in two different cases (ARGS
 > with FUNCTION and otherwise), hence in two different places in the
 > `special-display-popup-frame' code, then I might just use `defadvice'.  Or if
 > `s-d-p-f' provided a hook in those two places then I would just do the frame
 > fitting on that hook.  I do not especially _like_ redefinining vanilla
 > functions...
 >
 > I do not need to redefine `s-d-p-f' in prior Emacs versions.  That is presumably
 > because I already have frame-fitting on existing hooks.  Something in the
 > vanilla changes for Emacs 24 made it so that frame fitting was no longer
 > occurring in all cases, which led me to redefine `s-d-p-f'.  I'm not sure which
 > hooks were sufficient before.  I use, e.g., `after-make-frame-functions' and
 > `temp-buffer-show-hook'.
 >
 > I also redefine `switch-to-buffer' so that if the selected window is dedicated
 > (`window-dedicated-p') then it uses another window, regardless of argument
 > FORCE-SAME-WINDOW.  (If it is not dedicated then the vanilla `s-to-b' code is
 > invoked.)

I don't understand why you insist on using, advising, or redefining
`special-display-popup-frame'.  Customizing `display-buffer-base-action'
should be all you want.

BTW: With with-temp-buffer-window.el it's possible to customize
`temp-buffer-resize-frames' and automatically resize temporary frames.

martin