Closed bmag closed 8 years ago
uhu. Looks like we must store a per perspective dedicated window list, and undedicate/rededicate windows when switching.
Looks like we must store a per perspective dedicated window list, and undedicate/rededicate windows when switching.
Actually window-state-get
and window-state-put
do take care of saving and restoring the dedicated status, so unless I'm missing something that shouldn't be necessary.
The error in recipe 2 happens when window-state-put
tries to change the buffer of a dedicated window. It's a bug in window-state-put
that affects persp-mode. The bug is fixed in Emacs 25 and can be worked around in Emacs 24, details here.
Thanks for the quick reply.
Aha, OK. Thanks for the explanation.)
Should be fixed bf36bf8811a5b2a8f828e22ad387ed8368c94965
Thanks, but that fixes only the scenario described in recipe 2. Running the 1st recipe still gives me the same result. Do you get a different result on your machine?
Maybe I wasn't clear enough. There are two different scenarios that I reported in the original comment. The first is about creating a new perspective, and the second is about switching to an existing perspective. The latter is indeed fixed, the former is not.
Maybe I wasn't clear enough.
No, this is because of my laziness. Now it really should be fixed c6074ce3b61aca3e1ca1104ef5a751028357badf (i hope :p)
Yeah, that did it :smile:
Invoking
persp-switch
(C-c p s
) from a dedicated window results in a wrong window configuration after perspective is switched. This seems to be a problem with callingwindow-state-put
when the current window is a dedicated window, similar to https://github.com/wasamasa/eyebrowse/issues/36For example, consider neotree. When I open neotree, neotree creates a dedicated window and selects it. If I then switch to a different perspective, then neotree's window remains visible and the original window configuration of the perspective is ruined. More details in the reproduction recipes.
Adding
(set-window-dedicated-p nil nil)
right after(delete-other-windows)
here seems to fix the error described in recipe 2.Recipe 1: creating a new perspective when current window is dedicated:
emacs -Q -l /path/to/persp-mode.el
M-: (setq persp-auto-resume-time -1)
M-x persp-mode
C-x b foo
M-: (set-window-dedicated-p nil t)
C-c p s bar
Observed result: new perspective is created, the frame has two windows: one for buffer
foo
and one for the scratch buffer.Expected result: new perspective is created, the frame has one window: for the scratch buffer. The buffer
foo
is not visible.Recipe 2: switching to an existing perspective when current window is dedicated:
emacs -Q -l /path/to/persp-mode.el
M-: (setq persp-auto-resume-time -1)
M-x persp-mode
C-c p s bar
C-c p s baz
C-c p s none
C-x b foo
M-: (set-window-dedicated-p nil t)
C-c p s bar
Observed result: current perspective is now
bar
, but the displayed buffer remainsfoo
. The echo area shows the message "Window is dedicated tofoo'". In the
Messagesbuffer: "window-state-put: Window is dedicated to
foo'"Expected result: current perspective is now
bar
, the displayed buffer isbaz
.