Subject: Re: bug#23858: 25.0.95; window-state-get doesn't preserve side window status

From: martin rudalics <[email-masked]>
Date: Wed, 05 Oct 2016 14:30:22 +0200

> Calling 'window-state-get' to store a side window (or a window-tree that
 > contains a side window) and later calling 'window-state-put' to restore
 > the window doesn't keep the window's status as a side window. In other
 > words, the 'window-side' and 'window-slot' window paramters are not
 > saved and restored by 'window-state-get' and 'window-state-put'.
 >
 > I found that by adding the window parameters to
 > 'window-persistent-parameters' (details below), then 'window-state-get'
 > and 'window-state-put' do save and restore the side window's status as a
 > side window. Doesn't it make sense to add 'window-slot' and
 > 'window-side' to the default value of 'window-persistent-parameters'? Is
 > there a reason why it's not the case already?
 >
 > Thanks,
 > Bar
 >
 > recipe:
 > 1. emacs -Q
 > 2. evaluate (e.g. with 'M-:'):
 > (setq mywin (display-buffer (get-buffer-create "buff1")
 > '(display-buffer-in-side-window (side . left) (slot . 0))))
 > 3. evaluate:
 > (window-parameter mywin 'window-side)
 > returned value: left
 > 4. evaluate:
 > (window-state-put (window-state-get mywin t) mywin)
 > 5. evaluate:
 > (window-parameter mywin 'window-side)
 > returned value: nil
 > expected value: left
 >
 > The 'window-slot' window-parameter is likewise reset from 0 to nil at
 > step 4.
 >
 > How I modified 'window-persistent-parameters' to fix the problem:
 > (add-to-list 'window-persistent-parameters '(window-side . writable))
 > (add-to-list 'window-persistent-parameters '(window-slot . writable))

‘display-buffer-in-side-window’ now makes the `window-side' and
`window-slot' parameters persistent.  So I'm closing this bug.

Thanks, martin