Bad-ptr / persp-mode.el

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

Feature request: hook before persp-save-state-to-file #48

Closed bmag closed 8 years ago

bmag commented 8 years ago

TL;DR: please add a hook at the beginning of persp-save-state-to-file, so users can synchronize copy frame parameters (and other info) into current perspective's parameters before saving perspectives to file.


In Spacemacs, we have some integration between Eyebrowse and persp-mode, that lets us have different different eyebrowse workspaces for each perspective (the workspaces are "perspective-local"). Eyebrowse stores its workspaces as frame parameters, and for the integration we (Spacemacs) store the workspaces as perspective parameters. Every time the workspace or the perspective changes, we synchronize between the frame parameters and the perspective parameters, thus we have perspective-local workspaces. All of this is done through Eyebrowse and persp-mode hooks (which are great, by the way šŸ˜„).

An unexpected win is that the workspaces persist between sessions (awesome!), except for two issues:

The first issue I could fix by using persp-after-load-state-functions, but for the second issue I had to use a :before advice for persp-save-state-to-file. Using advice is of course risky, because upstream changes might break the advice, but I couldn't find any hook that satisfies our needs. Hence my feature request: please add a hook that runs at the beginning of persp-save-state-to-file.

If you want to see the actual code that I'm talking about (not merged yet), see this PR: https://github.com/syl20bnr/spacemacs/pull/7231/files

Bad-ptr commented 8 years ago

Ok, here it is 8d66aa2f9f16d64ab6808e80c25dd9baf7c9e754.

bmag commented 8 years ago

thank you very much