emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: delete-other-frames


From: Richard Copley
Subject: Re: delete-other-frames
Date: Tue, 23 Aug 2016 18:56:52 +0100

On 23 August 2016 at 15:09, Eli Zaretskii <address@hidden> wrote:
>> Date: Tue, 23 Aug 2016 10:19:59 +0200
>> From: martin rudalics <address@hidden>
>>
>> The problematic code in ‘delete-other-frames’ is this:
>>
>>      ;; Delete mon-minibuffer-only frames first, because `delete-frame'
>>      ;; signals an error when trying to delete a mini-frame that's
>>      ;; still in use by another frame.
>>      (dolist (frame frames)
>>        (unless (eq (frame-parameter frame 'minibuffer) 'only)
>>       (delete-frame frame)))
>>
>> Here we try to delete all frames whose `minibuffer' parameter is not
>> `only'.  However, the minibuffer window of a minibuffer-less frame might
>> be on a _normal_ frame as in our example: The minibuffer window of the
>> frame ‘less’ is owned by the initial frame and ‘delete-other-frames’
>> tries to delete that frame before ‘less’, resulting in the error cited
>> above.
>>
>> Should we document the current behavior in the doc-string or should we
>> amend the code?
>
> IMO, amend the code.
>
>> (2) The doc-string says "Delete all frames on the current terminal,
>> except FRAME."  IIUC this doesn't make much sense when FRAME is not on
>> the current terminal.  In that case, ‘delete-other-frames’ will delete
>> all frames on the current terminal and leave the frames on FRAME's
>> terminal alone.  In order to delete all other frames on FRAME's terminal
>> one has to make that terminal current first.  If that is the desired
>> behavior, we should mention it in the doc-string.  Otherwise, we should
>> delete all other frames on FRAME's terminal.
>
> The latter, I think.

Possibly related: from emacs -Q,

C-x b * RET ;; create and switch to buffer "*"
M-x ediff-buffers RET RET RET ;; ediff buffers "*" and "*scratch*"
;; Now attempt to close the main Emacs frame using the window manager

This gives:

Debugger entered--Lisp error: (error "Attempt to delete a surrogate
minibuffer frame")
  delete-frame(#<frame *scratch* 00000004009c5870> t)
  handle-delete-frame((delete-frame (#<frame *scratch* 00000004009c5870>)))
  funcall-interactively(handle-delete-frame (delete-frame (#<frame
*scratch* 00000004009c5870>)))
  call-interactively(handle-delete-frame nil [(delete-frame (#<frame
*scratch* 00000004009c5870>))])
  command-execute(handle-delete-frame nil [(delete-frame (#<frame
*scratch* 00000004009c5870>))] t)
  read-event(nil t 2)
  sit-for(2)
  execute-extended-command(nil "toggle-debug-on-error" "t-d-o-e")
  funcall-interactively(execute-extended-command nil
"toggle-debug-on-error" "t-d-o-e")
  call-interactively(execute-extended-command nil nil)
  command-execute(execute-extended-command)

I've never been sure whether this deserves a bug report, or what
should be the expected behaviour. FWIW when this happens my intention
is usually to kill Emacs. In any case the error message isn't very
user friendly.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]