help-gnu-emacs
[Top][All Lists]
Advanced

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

RE: [External] : view-remove-frame-by-deleting ignored?


From: Drew Adams
Subject: RE: [External] : view-remove-frame-by-deleting ignored?
Date: Sun, 9 Oct 2022 02:16:31 +0000

> > Try customizing option `frame-auto-hide-function'
> > to `delete-frame' instead of the default value
> > of `iconify-frame'.
> > ...
> > It's `quit-restore-window' that uses the option,
> > and so ends up deleting the frame.  And that's
> > called by `quit-window', which is called by
> > `View-quit'.
> 
> Where?
> 
> I don't seem to be able to find any place where this
> variable is referenced in the Emacs sources.  Toggling
> the option also doesn't seem to have any effect.
> Or am I too tired (could be)?

Hadn't try to find exactly where it's done (but
see below).  I see this, e.g., in Emacs 28.1 (and
earlier):

emacs -Q

M-x debug-on-entry quit-restore-window
M-x view-file-other-frame foo.el

Step through and you'll see something like this:

Debugger entered--entering a function:
* iconify-frame(#<frame *Backtrace* 000001e4b300f470>)
* window--delete(#<window 70 on foo.el> nil nil)
* #<subr quit-restore-window>(nil bury)
* apply(#<subr quit-restore-window> (nil bury))
* quit-restore-window(nil bury)
  quit-window()
  view-mode-exit(nil kill-buffer-if-not-modified)
  View-quit()
  funcall-interactively(View-quit)
  command-execute(View-quit)

Get rid of the frame and buffer for foo.el, to start
over.

Use `M-x customize-option frame-auto-hide-function'
to set the option to `delete-frame' (instead of the
default, `iconify-frame').

M-x view-file-other-frame foo.el

Step through and you'll see something like this:

Debugger entered--entering a function:
* delete-frame(#<frame *Backtrace* 000001e4b3017840>)
* window--delete(#<window 7 on foo.el> nil nil)
* #<subr quit-restore-window>(nil bury)
* apply(#<subr quit-restore-window> (nil bury))
* quit-restore-window(nil bury)
  quit-window()
  view-mode-exit(nil kill-buffer-if-not-modified)
  View-quit()
  funcall-interactively(View-quit)
  command-execute(View-quit)

In more detail, it comes from this return value
from `window-deletable':

Debugger entered--returning value: frame
  window-deletable-p(#<window 124 on foo.el>)
* #<subr window--delete>(#<window 124 on foo.el> nil nil)
* apply(#<subr window--delete> (#<window 124 on foo.el> nil nil))
* window--delete(#<window 124 on foo.el> nil nil)
  quit-restore-window(nil bury)
  quit-window()
  view-mode-exit(nil kill-buffer-if-not-modified)
  View-quit()
  funcall-interactively(View-quit)
  command-execute(View-quit)

And that's from this code in `window-deletable-p':

(cond
 ((frame-root-window-p window)
  ;; WINDOW's frame can be deleted only if there are other frames
  ;; on the same terminal, and it does not contain the active
  ;; minibuffer.
  (unless (or (eq frame (next-frame frame 0))
          ;; We can delete our frame only if no other frame
          ;; currently uses our minibuffer window.
          (catch 'other
            (dolist (other (frame-list))
              (when (and (not (eq other frame))
                         (eq (window-frame
                               (minibuffer-window other))
                         frame))
                (throw 'other t))))
          (let ((minibuf (active-minibuffer-window)))
            (and minibuf (eq frame (window-frame minibuf))
                 (not (eq (default-toplevel-value
                            'minibuffer-follows-selected-frame)
                          t)))))
    'frame))



reply via email to

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