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

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

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


From: martin rudalics
Subject: bug#23858: 25.0.95; window-state-get doesn't preserve side window status
Date: Tue, 28 Jun 2016 10:25:08 +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'.

Correct.

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

It would be a (slight) penalty for the majority of users who never use
side windows.  A more stringent problem is that I wouldn't know what to
do with other window parameters like 'quit-restore', 'window-atom',
'delete-window', 'other-window'?  Wouldn't it be inconsistent to add
only these two to the list of persistent parameters?

The major obstacle though is that side windows conceptually should not
be saved by ‘window-state-get’ at all.  This was part of the IDE concept
discussed on emacs-devel many years ago: The window states to save and
restore are those of the interior (non-side) windows.  Normally, the
side windows would stay arranged permanently around the major non-side
window and only the contents of the latter would change according to
what the user prefers to work on.

Alternatively, the side windows could be removed temporarily to give the
user the entire frame estate for editing.  In that case, the side
windows would have to be regenerated from scratch whenever the user
wanted to see them again.  While inconvenient for the application
programmer, I was told that the existing IDEs did that already and I
also had no good idea of how to save/restore the state of side windows
only w/o also saving/restoring the state of the major non-side window.

I'm not sure wheter you can follow these arguments - feel free to ask
whenever you find something incomprehensible ...

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

Out of curiosity: Which kinds of buffers do you display on the left?

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

I'd prefer to remove the parameter in this case but so far was too lazy
to implement that.

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

This is IMO the correct way to handle this.  Does it work?  Did you ever
test it via the ‘desktop-save’ feature?

martin






reply via email to

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