Bad-ptr / persp-mode.el

named perspectives(set of buffers/window configs) for emacs
400 stars 44 forks source link

Order of loaded perspectives is inconsistent #53

Closed bmag closed 7 years ago

bmag commented 7 years ago

It seems that if I save some perspectives to file with persp-save-to-file-by-names, and in later Emacs sessions I load that file with persp-load-state-from-file, then the order of perspectives (as returned by persp-names-current-frame-fast-ordered) is inconsistent . For some reason, if I save with persp-save-state-to-file instead of persp-save-to-file-by-names, then the order is consistent (at least in the scenario I tried).

Original report: https://github.com/syl20bnr/spacemacs/issues/7396

Reproduction guide :beetle:

(require 'package)
(package-initialize)
(setq persp-auto-resume-time -1)
(require 'persp-mode)
(persp-mode)

Observed behaviour: :eyes: :broken_heart:

Output of (persp-names-current-frame-fast-ordered) is inconsistent. It alternates between ("none" "foo" "bar") and ("none" "bar" "foo").

Expected behaviour: :heart: :smile:

Output of (persp-names-current-frame-fast-ordered) should be consistent - ("none" "foo" "bar") everytime.

Bad-ptr commented 7 years ago

possibly fixed 4aac831b911a475ff68fe27642213b7a4c6ac34d

bmag commented 7 years ago

I can confirm that it is fixed, at least for this set of names. We did get a report on spacemacs (https://github.com/syl20bnr/spacemacs/issues/7459) that the order is consistent, but it doesn't reflect the order in which the perspectives were created. I'm not sure if that is supposed to be a supported feature, though, because I didn't see persp-mode's documentation talking about the order of perspectives.

In the linked report, SPC l <number> calls persp-switch, SPC l S calls persp-save-to-file-by-names, SPC l L calls persp-load-state-from-file, and the order is the same as returned by persp-names-current-frame-fast-ordered (and "layout" means "perspective", as you probably know already).

jluttine commented 7 years ago

Yep, I can confirm that the alternating order issue has been fixed. However, previously my layout order was preserved when saving, not anymore. So I'm guessing that some recent changes have broken that (if that is even something that was supposed to be supported). Or is there some other way how to set the order of layouts (perspectives?)?

EDIT: My hypothesis is that if there are hyphens in the names, the ones with hyphens in the names are put first in the saved order. I wasn't able to reproduce the issue without having hyphens in some names.

Bad-ptr commented 7 years ago

@jluttine your issue must be fixed now(d7ccbf8e7959beaab3ff9c0bd266d337940ffe3d)

bmag commented 7 years ago

@jluttine after you install the updated persp-mode, can you report if the issue is fixed, and then I'll close both issues (this one and the one in spacemacs)?

jluttine commented 7 years ago

I tested now and it seems to work. Thanks!