GNU bug report logs -
#33458
27.0.50; dired loses position when reverted from outside place
Previous Next
Reported by: v88m <at> posteo.net
Date: Wed, 21 Nov 2018 20:46:01 UTC
Severity: minor
Found in version 27.0.50
Fixed in version 27.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
Message #151 received at 33458 <at> debbugs.gnu.org (full text, mbox):
>> 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
This bug report was last modified 4 years and 330 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.