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

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

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


From: martin rudalics
Subject: bug#33532: 26.1; set-window-configuration does not restore display start
Date: Thu, 29 Nov 2018 09:31:55 +0100

> 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 ...

But the whole text is

  In order to store a window configuration on
  disk and read it back in another Emacs session, you can use the
  functions described next.

and the functions mentioned there are `window-state-get' and
`window-state-put'.  So you have to tell us what you want to fix: The
behavior of window configurations throughout one and the same Emacs
session (which uses markers to restore positions) or when restoring a
previous session (which relies on positions only).

> In such use cases, I want to restore the exact same text in all buffers,

What is "to restore the exact same text in all buffers"?  The text at
the time the configuration was stored in a register?  That one might
not be available any more.  Restoring a window configuration (or
state) can only use the buffer text as is and adjust positions
accordingly.

> and then restore the window configuration, including display starts.
>
> 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,

I suppose you mean "kill all buffers" here.  This will implicitly make
the window start and point positions of any window that showed the
buffer previously and is stored in a configuration to point nowhere.
Furthermore, there is no guarantee that the same buffer will be shown
in that window when the configuration is restored.

> 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.

If you use window states instead of configurations then this should
work.  States store positions instead of markers.

> 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?

Emacs tries its best to do that.  But killing and reverting buffers,
among other operations, can defy such attempts.  So you either should
try 'window-state-get' and 'window-state-put' to do what you want or
save any positions separately before killing buffers and restore them
together with their buffers after restoring a configuration.

martin





reply via email to

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