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

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

bug#33458: 27.0.50; dired loses position when reverted from outside plac


From: martin rudalics
Subject: bug#33458: 27.0.50; dired loses position when reverted from outside place
Date: Mon, 17 Dec 2018 09:06:47 +0100

>> Imagine a scenario where a user (1) displays a buffer in new window,
>> (2) switches in that window to another buffer and (3) deletes that
>> window for good.  When and how would the buffer-local reference
>> created in (2) be removed?
>
> Another question: When should the buffer-local reference be added?
>
> Every time when point is moved to a new file?  Too frequent calls especially
> in cases of e.g. pressing and holding the spacebar to move thru the file list.
>
> Or when current-window-configuration is saved to a variable/register
> or window-state-get is called?  I don't know what hook is possible
> to use at that moment besides advices.

I'm not sure whether my scenario above was entirely clear.  The
"buffer-local reference" I was talking about would be a buffer-local
list whose cars are all the windows (including dead ones) that showed
the buffer before.  When reverting a buffer, we would traverse that
list, and for every window in that list (including dead windows) look
up the buffer reference in that window's previous buffers, calculate
the new window point position from the old position and store back the
new position as marker in situ there.

For dired, for example, one would go to the old position, look at what
file is displayed there, remember the name of that file, revert the
buffer and in the reverted buffer search for the file name and store
an appropriate position as new window point for that window (including
windows still dead).  For other buffers we would use the default
'revert-buffer' function and have it do whatever it does now for live
windows showing the buffer.

In either case, reverting proper would be oblivious to whether any
window point it transforms is that of a live or dead window.  Still
this is nothing for the faint-hearted because the only surgery we
allowed on dead windows so far was to resurrect them in a restored
window configuration.

So the answer to your question "When should the buffer-local reference
be added?" is the earlier alluded to "in (2) when we unshow that
buffer in a window".  And the problem we have to solve is when to
remove such a reference because the referenced window is really dead
and no more referenced by any saved window configuration.

Note: We alternatively could store the position information from
windows' lists of previous buffers as buffer-local lists.  This would
make reverting slightly simpler and switching to a window's previous
or next buffer a bit more complicated.  But we would still have to
find out whether any window referenced that way from a buffer is still
referenced from a saved window configuration.

martin





reply via email to

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