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

From: martin rudalics <[email-masked]>
Date: Thu, 29 Nov 2018 09:31:16 +0100

> The main question: why the result of setting point with goto-char
 > is ignored when the buffer's display is restored in a window?

Because it uses a marker position that was reset and not restored when
reverting the buffer.  We'd have to assess how reverting a buffer
affects window start and point positions when the buffer is displayed
in several windows with different such positions.  If that mechanism
works satisfactorily (and I think it does), it would be nice to extend
it to the lists of windows' previous buffer start and point markers as
you suggested earlier.  Provided it's not too expensive.

 > Maybe we should introduce a new buffer-local variable with a name like
 > window-point, to set it like (setq window-point vc-sentinel-movepoint)
 > or in dired-revert like (setq window-point dired-point)
 > Then window functions that display the buffer in a window should
 > obey this variable and set the window point to the requested value.

The buffer's point is OK.  So we could introduce a variable, say
'set-window-point-from-point', and set this to t when reverting a
buffer reveals that 'get-buffer-window' is nil.  Redisplaying the
buffer would then always go to the buffer's point instead of some
position stored in the window's list of previous buffers.

I'm not sure when to reset this mechanism though.  The first time we
display the buffer again?  Then switching to that buffer in another
window later would suffer from the initial problem.  Keep it for every
other window until it has seen the buffer again?  How would we do
that?

Finally note that this does not fix the dired problem.  There we want
the cursor go to the line showing the file where point previously was
in that window.

martin