Subject: bug#33871: 27.0.50; Revert Dired window saved in window configuration

From: martin rudalics <[email-masked]>
Date: Sat, 29 Dec 2018 19:18:53 +0100

> In the cases I faced, I found it a drawback that the current buffer is
 > treated differently than the others by current-window-configuration:

I'm not sure what precisely you mean here.  'save-window-excursion'
saves and restores the current buffer so that the restored state
replicates the saved state as closely as possible.  Hence, the buffer
current when the old configuration was saved should be also current
after the old configuration has been restored, regardless of whether
it is the buffer assigned to any of the selected windows.

If you allude to the

   As a special exception, the window
   configuration does not record the value of point in the selected window
   for the current buffer.

then this behavior is provided for historical reasons AFAICT.  Most
applications using a window excursion probably did not like the cursor
jump back to the old location.

 > Suppose it did not make such an exception. Then it would be quite easy
 > to manually implement exceptional behaviour for the current buffer. But
 > the converse is not so easy: It is harder to manually obtain the desired
 > behaviour if we *want* the current buffer to be treated like the others,
 > when the function already treats it differently. If it didn't, then a
 > simple save-excursion, or a similar mechanisms, around restoring the
 > window configuration could ostensibly restore the state for all buffers
 > except the current one, resulting in the same behaviour that we get now.
 > At least that was my impression when using window configurations.

It depends on what you want to handle manually.  Note that if you do
not save any additional information separately, a window configuration
by itself does not give you any clue as to which buffer was current or
which window was selected at the time it was saved.

What we could do is to give 'set-window-configuration' an additional
argument which, for example, would allow to restore the selected
window's point to its saved position.

martin