Subject: bug#33532: 26.1; set-window-configuration does not restore display start

From: Eli Zaretskii <[email-masked]>
Date: Wed, 28 Nov 2018 19:41:56 +0200

> From: Markus Triska <[email-masked]>
> Cc: [email-masked]
> Date: Wed, 28 Nov 2018 18:13:57 +0100
> 
> Eli Zaretskii <[email-masked]> writes:
> 
> > How important is the use case of replacing buffer text with identical
> > text?  Because replacing with a different text will make preserving
> > window-start position based on its numerical value not really a
> > sensible thing, would it?  It could even be impossible, e.g. if the
> > same position happens to be in the middle of a sequence of composed
> > characters.
> 
> Please consider a use case that is described in the Emacs manual:
> 
>     In order to store a window configuration on disk and
>     read it back in another Emacs session ...
> 
> In such use cases, I want to restore the exact same text in all buffers,
> and then restore the window configuration, including display starts.

Please propose how to do that.  If it can be done ion a useful manner,
I don't see why we shouldn't.

> In fact, the snippet illustrates an even simpler situation: It stores
> the configuration in a variable, and the session keeps running.  I would
> like to obtain the configuration, then close all buffers, and later
> restore their contents (for example, from files), and then use
> set-window-configuration to restore the original window configuration,
> including all window-starts.

Well, you get everything _excluding_ the window-start.  I think it's
still a bargain.

> Could set-window-configuration be generalized to reliably restore the
> window-starts also in such cases? If not, please consider adjusting the
> documentation to make clear what this actually guarantees. In
> particular, when are window-starts reliably restored, and when not?

As long as the buffer text exists, you will get the best approximation
to restoring window-start.