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

From: "Drew Adams" <[email-masked]>
Date: Fri, 10 Aug 2012 10:47:05 -0700

> Please try to come up with a self-contained, 
> reasonably small test case.
> 
>  > After that, evaluating (window-parameters) in any window 
>  > (AFAICT) returns nil.

Digging further I found the problem in my code, which was preventing
(window-parameters) from returning non-nil, and also apparently preventing
special-display buffers from having dedicated windows.  The problem was not due
to your code.

FYI -

I have code that redefines `special-display-popup-frame' (only for Emacs 24+)
just so that the frame is fit to the buffer contents.  The latest version I had
was based on a vanilla Emacs snapshot that was old - it did not have a call to
`display-buffer-record-window'.

With that code updated now per the latest Emacs 24 sources, `window-parameters'
does not always return nil, and special-display buffers seem to have dedicated
windows as they should.

So I think this brings some closure.  I do hope you will merge your code into
Emacs.  If there is something additional you would like me to test, let me know.
This will be a big improvement, for me at least.  Thank you for your efforts.

---

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?

Even if the buffer is already displayed somewhere, shouldn't a frame that it is
displayed in be raised?  In particular, the frame that is the `window-frame' of
the window returned by FUNCTION applied to its args?

---

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.)