all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* quit-window and solitary window
@ 2008-02-27  9:46 Drew Adams
  0 siblings, 0 replies; only message in thread
From: Drew Adams @ 2008-02-27  9:46 UTC (permalink / raw)
  To: emacs-pretest-bug

The code for `quit-window' does this:

(let (...(window-solitary ... (one-window-p t)))
  ...
  (and ... (not window-solitary) (delete-window window)))

This does not do what I want. I want the window deleted when I, well,
quit the window (!). And that means the frame too, if there is only
one window. Please consider changing the treatment of a solitary
window in this way: Just call `delete-window' inside a
`condition-case'.  Simple.

Just get rid of the `window-solitary' hack at the end, and do this
instead:

(condition-case nil
    (delete-window window)
  (error nil))

That should make everyone happy. Please consider it.

I use such a redefinition of `quit-window' in my own code. I also use
a redefined `delete-window' that deletes a `one-window-p' frame. The
result for me is that `quit-window' deletes a `one-window-p' frame -
just what I want.

If I didn't do that, it would be annoying for me to have `quit-window'
replace the current buffer in the frame (my frames are typically
`one-window-p', but not all use dedicated windows) by some totally
irrelevant buffer (since it calls `bury-buffer') that was perhaps
never even displayed - a surprise popup that is useless.

The reason I need to redefine `quit-window' also, and not just
`delete-window', is that the vanilla `quit-window' code tries to be
"smart" and not call `delete-window' for a `one-window-p' frame if the
window is not dedicated.

Making the change I suggest for `quit-window' in Emacs should give
everyone what they want. Those who like the current behavior will
still get it. And I'll be able to remove another redefinition.
(Eventually, perhaps, I will convince Emacs dev to DTRT for
`delete-window' also. ;-))

BTW, I suspect that the part of the `quit-window' code that tries to
avoid deleting the sole visible frame of an Emacs session is
unnecessary also: (delq frame (visible-frame-list)). The (vanilla)
`delete-window' code already ensures that you can't delete the sole
frame - it raises the error "Attempt to delete-minibuffer or sole
ordinary window". Perhaps this test is still needed in `quit-window',
to avoid setting `window' to nil, but I kind of doubt it.


In GNU Emacs 22.1.90.1 (i386-mingw-nt5.1.2600)
 of 2008-01-30 on PRETEST
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (3.4) --cflags -Ic:/gnuwin32/include'






^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-02-27  9:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-27  9:46 quit-window and solitary window Drew Adams

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.