unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: "'martin rudalics'" <rudalics@gmx.at>
Cc: 7533@debbugs.gnu.org
Subject: bug#7533: 24.0.50; `dired-mark-pop-up': delete frame afterwards if `pop-up-frames' [PATCH]
Date: Sat, 26 May 2012 10:55:42 -0700	[thread overview]
Message-ID: <7783B19C74CD4DFAA1E6410A507A69C8@us.oracle.com> (raw)
In-Reply-To: <0F6E005543DB4891A01F42BEA11DE520@us.oracle.com>

[-- Attachment #1: Type: text/plain, Size: 1779 bytes --]

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  <drew.adams@oracle.com>

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

[-- Attachment #2: dired-2012-05-26.patch --]
[-- Type: application/octet-stream, Size: 2556 bytes --]

diff -c dired.el dired-patched-2012-05-26.el
*** dired.el	Sat May 26 09:48:52 2012
--- dired-patched-2012-05-26.el	Sat May 26 10:43:26 2012
***************
*** 2988,3009 ****
  in the case of one marked file, to distinguish that from using
  just the current file."
    (or bufname (setq bufname  " *Marked Files*"))
!   (if (or (eq dired-no-confirm t)
! 	  (memq op-symbol dired-no-confirm)
! 	  ;; If FILES defaulted to the current line's file.
! 	  (= (length files) 1))
!       (apply function args)
!     (with-current-buffer (get-buffer-create bufname)
!       (erase-buffer)
!       ;; Handle (t FILE) just like (FILE), here.
!       ;; That value is used (only in some cases), to mean
!       ;; just one file that was marked, rather than the current line file.
!       (dired-format-columns-of-files (if (eq (car files) t) (cdr files) files))
!       (remove-text-properties (point-min) (point-max)
! 			      '(mouse-face nil help-echo nil)))
!     (save-window-excursion
!       (dired-pop-to-buffer bufname)
!       (apply function args))))
  
  (defun dired-format-columns-of-files (files)
    (let ((beg (point)))
--- 2988,3016 ----
  in the case of one marked file, to distinguish that from using
  just the current file."
    (or bufname (setq bufname  " *Marked Files*"))
!   (let (result)
!     (if (or (eq dired-no-confirm t)
!             (memq op-symbol dired-no-confirm)
!             ;; If FILES defaulted to the current line's file.
!             (= (length files) 1))
!         (setq result  (apply function args))
!       (with-current-buffer (get-buffer-create bufname)
!         (erase-buffer)
!         ;; Handle (t FILE) just like (FILE), here.
!         ;; That value is used (only in some cases), to mean
!         ;; just one file that was marked, rather than the current line file.
!         (dired-format-columns-of-files (if (eq (car files) t) (cdr files) files))
!         (remove-text-properties (point-min) (point-max)
!                                 '(mouse-face nil help-echo nil)))
!       (unwind-protect
!            (save-window-excursion
!              (dired-pop-to-buffer bufname)
!              (setq result  (apply function args)))
!         (ignore-errors
!           (select-window (get-buffer-window bufname 0))
!           (if (one-window-p) (delete-frame) (delete-window)))
!         (bury-buffer bufname)))
!     result))
  
  (defun dired-format-columns-of-files (files)
    (let ((beg (point)))

Diff finished.  Sat May 26 10:48:28 2012

  reply	other threads:[~2012-05-26 17:55 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-02 18:35 bug#7533: 24.0.50; `dired-mark-pop-up': delete frame afterwards if `pop-up-frames' Drew Adams
2010-12-02 19:05 ` martin rudalics
2010-12-02 19:22   ` Drew Adams
2010-12-03  8:17     ` martin rudalics
2010-12-03 16:22       ` Drew Adams
2010-12-03 18:16         ` martin rudalics
2010-12-03 18:33           ` Drew Adams
2010-12-03 18:41             ` martin rudalics
2010-12-04 22:44               ` Chong Yidong
2010-12-16 18:27                 ` Drew Adams
2010-12-17  6:32                   ` martin rudalics
2010-12-17 15:32                     ` Drew Adams
2010-12-17 16:12                       ` martin rudalics
2010-12-17 16:55                         ` Drew Adams
2010-12-17 18:09                           ` martin rudalics
2010-12-17 18:40                             ` Drew Adams
2010-12-21  6:48                           ` Chong Yidong
2010-12-03 20:27       ` Stefan Monnier
2012-04-05 20:23         ` Drew Adams
2012-04-06 14:02           ` martin rudalics
2012-04-06 14:44             ` Drew Adams
2012-04-06 14:53               ` martin rudalics
2012-04-06 15:34                 ` Drew Adams
2012-04-06 15:47                   ` martin rudalics
2012-04-06 16:10                     ` Drew Adams
2012-04-06 16:56                       ` martin rudalics
2012-04-06 17:08                         ` Drew Adams
2012-04-18 14:32                           ` Drew Adams
2012-05-25 20:52                             ` Drew Adams
2012-05-26 17:55                               ` Drew Adams [this message]
2012-05-27 13:21                                 ` bug#7533: 24.0.50; `dired-mark-pop-up': delete frame afterwards if `pop-up-frames' [PATCH] martin rudalics
2012-05-27 14:33                                   ` Drew Adams
2011-01-18 22:14 ` bug#7533: 24.0.50; `dired-mark-pop-up': delete frame afterwards if `pop-up-frames' Drew Adams
2012-09-05 14:30 ` martin rudalics
2012-09-05 14:33   ` Drew Adams
2012-10-03  9:11     ` martin rudalics
2012-10-03 15:52     ` Drew Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7783B19C74CD4DFAA1E6410A507A69C8@us.oracle.com \
    --to=drew.adams@oracle.com \
    --cc=7533@debbugs.gnu.org \
    --cc=rudalics@gmx.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).