emacs-devel
[Top][All Lists]
Advanced

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

quit-window and solitary window


From: Drew Adams
Subject: quit-window and solitary window
Date: Wed, 27 Feb 2008 01:46:11 -0800

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'






reply via email to

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