Subject: 25.0.95; window-state-get doesn't preserve side window status
From: bmag bmag <[email-masked]>
To: [email-masked]
Date: Mon, 27 Jun 2016 23:07:14 +0300
List-Id: <debbugs-submit.debbugs.gnu.org>

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

In GNU Emacs 25.0.95.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.18.9)
 of 2016-06-27 built on matrix
Windowing system distributor 'The X.Org Foundation', version 11.0.11803000
System Description:    Ubuntu 16.04 LTS

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF GSETTINGS
NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11

Important settings:
  value of $LC_MONETARY: he_IL.UTF-8
  value of $LC_NUMERIC: he_IL.UTF-8
  value of $LC_TIME: he_IL.UTF-8
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent messages:
next-line: End of buffer
Mark set
((window-side . writable) (clone-of . t))
((window-slot . writable) (window-side . writable) (clone-of . t))
#<window 8 on buff1>
left
nil
left
Quit [2 times]
Making completion list...

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message dired format-spec rfc822 mml
mml-sec password-cache epg epg-config gnus-util mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail
rfc2047 rfc2045 ietf-drums mm-util help-fns help-mode easymenu
cl-loaddefs pcase cl-lib mail-prsvr mail-utils time-date mule-util
tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type
mwheel x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt
fringe tabulated-list newcomment elisp-mode lisp-mode prog-mode register
page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock
font-lock syntax facemenu font-core frame cl-generic cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese charscript case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer cl-preloaded nadvice
loaddefs button faces cus-face macroexp files text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote dbusbind inotify dynamic-setting
system-font-setting font-render-setting move-toolbar gtk x-toolkit x
multi-tty make-network-process emacs)

Memory information:
((conses 16 89002 9010)
 (symbols 48 19908 0)
 (miscs 40 521 171)
 (strings 32 14980 4488)
 (string-bytes 1 440881)
 (vectors 16 12224)
 (vector-slots 8 438921 6034)
 (floats 8 168 256)
 (intervals 56 219 11)
 (buffers 976 13)
 (heap 1024 36895 1038))