Subject: bug#7533: 24.0.50; `dired-mark-pop-up': delete frame afterwards if `pop-up-frames' [PATCH]

From: "Drew Adams" <[email-masked]>
Date: Sat, 26 May 2012 10:55:42 -0700

Martin wrote:

> IIUC your patch works regardless of the value of
> `frame-auto-hide-function'.  The problem of your patch is that in
>    (if (one-window-p) (delete-frame) (delete-window))
> the window for showing the buffer may have been _reused_ in which case
> deleting is certainly the wrong solution.

I do not understand how/why that window would or should be reused.

Especially between the time it becomes displayed and the end of the calling
function.  The window is only for the user interaction of confirming (or not)
the operation on the marked files.

The existing code seems to reflect this aim in that it uses
`save-window-excursion'.  What is still missing is (a) deletion of the window or
frame (if `one-window-p') and (b) burial of the buffer.  And this should happen
always, regardless of what the user does, including `C-g'.

If the buffer is not shown in a separate frame then the `save-window-excursion'
alone seems to remove/hide the window - great.  And that is why more people are
not complaining about this regression, IMO.

But if the buffer is shown in a separate frame (e.g. due to
`special-buffer-regexps') then `save-window-excursion' is simply not sufficient.
The frame remains displayed after the user interaction, regardless of what the
user does during the interaction (including `C-g').

Attached is a patch against the latest source code.  AFAIK it DTRT.  Can anyone
point to a reasonable situation where it does not DTRT - IOW, where what it does
is inappropriate?  If not, can this please be installed for Emacs 24.1, to
eliminate this regression?  Thx.

Here is a change-log entry for the patch:

2012-05-26  Drew Adams  <[email-masked]>

	* dired.el (dired-mark-pop-up):
	Delete the marked-files window/frame and bury its buffer.