[Top][All Lists]

[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: Markus Triska
Subject: bug#33532: 26.1; set-window-configuration does not restore display start
Date: Thu, 29 Nov 2018 19:09:47 +0100
User-agent: Emacs/24.5

martin rudalics <address@hidden> writes:

> and the functions mentioned there are `window-state-get' and
> `window-state-put'.

These functions have an analogous issue, which you can see with:

    (let ((buf (get-buffer-create "buf")))
      (switch-to-buffer buf)
      (dotimes (x 10)
        (insert (format "x is %s\n" x)))
      (recenter 3)
      (sit-for 1)
      (let ((conf (window-state-get))
            (ws (window-start))
            (str (with-current-buffer buf (buffer-string))))
        (with-current-buffer buf
          (insert str))
        (window-state-put conf)
        (sit-for 1)
        (message "window-start: %s vs. %s" ws (window-start))))

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

If possible, please fix both. I filed the simpler case first, but both
functions are broken.  For now, I would like to concentrate on the case
that only involves variables in the same Emacs session, without saving
files to disk. I can file a separate issue for the other function.

> What is "to restore the exact same text in all buffers"?  The text at
> the time the configuration was stored in a register?

It means the buffer text that can be obtained for example with
(buffer-string), and can be restored exactly as it was at any time. The
snippet I posted illustrates this case.

> Restoring a window configuration (or state) can only use the buffer
> text as is and adjust positions accordingly.

This is what I am asking for, and what currently does not work. Please
see the snippet I posted for a reproducible test case: The buffer text
is what it was, but the start position is not restored.

> Furthermore, there is no guarantee that the same buffer will be shown
> in that window when the configuration is restored.

The fact that other guarantees are also broken is definitely
unfortunate. However, improving just the particular aspect I mentioned
would already be extremely helpful for my use case.

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

Please see above: The snippet shows that it doesn't work. Also, I am
primarily interested in the window configuration, and the documentation
suggests that the window-start is saved (and restored).

If possible, please consider implementing this, or adjusting the
documentation so that it states what is actually guaranteed.

Thank you and all the best,

reply via email to

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