emacs-devel
[Top][All Lists]
Advanced

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

Re: Window configurations


From: martin rudalics
Subject: Re: Window configurations
Date: Wed, 12 May 2010 11:29:00 +0200
User-agent: Thunderbird 2.0.0.21 (Windows/20090302)

>> ... where `quit-restore-window' here replaces `quit-window' which has
>> too obscure semantics for my taste.  And obviously, exiting `view-mode'
>> calls `quit-restore-window' here too.
>
> Yes, `quit-window' is useless because it doesn't help to avoid the mess
> that occurs after killing buffers.

You don't mean buffers killed by `quit-window' but by some standalone
`kill-buffer' I suppose?

> Now do the same without using `view-mode' - visit a file in dired 1 with
> RET, select the second window, visit another file in dired 2, select the
> first window, kill the buffer, select the second window, kill the buffer:
>
>   `RET  C-x o  RET  C-x o  C-x k  C-x o  C-x k'
>
> The window configuration is broken with original buffers exchanged
> their windows:
>
> +---------+---------+
> |         |         |
> | dired 2 | dired 1 |
> |         |         |
> |         |         |
> +---------+---------+

The culprit here is the `other-buffer' call when unshowing the buffer.
Practically all occurrences of `other-buffer' in window handling code
are harmful.  Their original purpose was to make sure that the same
buffer isn't displayed twice on a frame I suppose.

> 2. Another example - visit the same buffer in two windows, and put point
> at different positions of the same buffer.
>
> +---------+---------+
> |         |         |
> | dired 1 | dired 1 |
> |         |         |
> |         |         |
> +---------+---------+
>
> Now view a file in the first window, and quit: `v q'.
> The window configuration is correctly restored
> (without using `set-window-configuration') - good.
>
> Now do the same without `view-mode': `RET C-x k'.
> Instead of the original buffer, some random buffer is displayed
> in this window.

That's probably the most annoying instance of this.  For some magic
reason Emacs assumes that people never want to simultaneously look at
two distinct portions of the same buffer ;-)

> It seems your implementation of `quit-restore-window' will fix this problem,
> but I don't see how it will work without a window history as a list?

It doesn't solve any of these problems yet because `dired-find-file'
uses `switch-to-buffer' and in `switch-to-buffer' I don't record any
information about the dired buffer.  I obviously could do so easily but
we'd have to find a general agreement first.

And, for lack of a history, it works only for the last `display-buffer'
action which is sufficient for view mode purposes (by reverting to the
last buffer displayed before view mode was entered).

> This list could be saved as a window parameter `window-history' where each
> element is like you implemented for the `quit-restore' parameter.

Yes.  We have to agree that we pay for the costs of this though.

> Then every switch-to-buffer could add a `quit-restore' element to the
> window history parameter,

We'd have to enumerate all actions that would add such an element.

> and every kill-buffer could remove it from the
> history stack (and call its function at the same time).

`kill-buffer' would probably scan all live windows' history stacks.

But are we sure that a stack (a deque, rather) is sufficient?

martin



reply via email to

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