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

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

bug#46904: Non-unique windows produced by window-state-put


From: martin rudalics
Subject: bug#46904: Non-unique windows produced by window-state-put
Date: Thu, 4 Mar 2021 09:35:26 +0100

> We have a problem in window-state-put.  For example, in emacs -Q
> evaluate this several times:
>
> (progn
>    (window-state-put
>     (window-state-get
>      (frame-root-window (selected-frame))
>      'writable)
>     (frame-root-window (selected-frame)) 'safe)
>    (selected-window))
>
> Every time the selected window remains the same:
>
>    #<window 3 on *scratch*>
>
> But after splitting the window with e.g. 'C-x 2',
> evaluating the same every time creates a new window
> that it's expected to do even when there is only one window
> on the frame.

You mean we should do that

            ;; Create a new window to replace the existing one.
            (setq window (prog1 (split-window window)
                           (delete-window window)))))

in the one window case too?  This would be certainly more consistent but
I do not remember any more why this is needed in the multiple windows
case.

> I don't know how severe are the consequences.  The only side-effect I noticed
> that prev-buffers of restored windows are the same on different tabs because
> they share the same window.

If that is a problem and the above would help, let's do it.  It couldn't
possibly harm unless the root window is too small to get split and we
want to put only one window there; so we should handle that special case.

martin





reply via email to

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