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

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

bug#1259: quit-window: does it quit the wrong buffer?


From: martin rudalics
Subject: bug#1259: quit-window: does it quit the wrong buffer?
Date: Tue, 04 Nov 2008 19:15:40 +0100
User-agent: Thunderbird 2.0.0.16 (Windows/20080708)

> Is there a reason why you're not calling delete-window-on in all cases?

Just for the case that I have two windows showing the same buffer and
invoke `quit-window' on one of them.  In this case I want to leave the
other window alone.  (BTW, using `delete-windows-on' for a frame showing
_one_ window is a kludge - but `delete-windows-on' is the only function
I found that handles some corner cases in this area correctly.)

> Why the condition-case only for delete-window?

I don't think it's needed.  But delete_window has a strange loop I never
understood completely which can err with "Cannot delete window" and I
wanted to avoid that.

> Also, why the explicit switch-to-buffer?
> Should quit-window switch to the buffer that would be displayed if the
> current buffer was killed or just buried?

That was already in the old version of `quit-window'.  Note that when
WINDOW is not the selected window, `bury-buffer' leaves the buffer
displayed in WINDOW.  `quit-window' must remove the buffer from WINDOW
even if WINDOW is not selected.

In any case, don't expect too much from `quit-window'.  The underlying
logic is too weak to make it more useful.  What we really need is a
buffer-local variable say `quit-windows-on' which, when set, triggers
some special code in `set-window-buffer' and `display-buffer'.  The
former would simply record in a window-local variable `how-to-quit' the
buffer formerly displayed in the window and `quit-window' could switch
to that buffer, provided its still live.

`display-buffer' would do the same but in addition, when it splits a
window to display the buffer, set `how-to-quit' to t so `quit-window'
could eventually delete that window.  A similar solution would have
`quit-window' delete a stand-alone frame popped up by `display-buffer'.

Most of this has been implemented in Lisp in some form or the other but
that's not sufficient.  `set-window-buffer' must act on this.

martin







reply via email to

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