-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for saving and restoring perspectives to disk #80
Conversation
Just a note to say I'm interested in this feature and am testing it out as of a few moments ago. Really appreciate all the work that's gone into perspective, this feature included! |
I was getting errors from It seemed like these records were accumulating and causing format issues on subsequent loads so I made two changes:
With those adjustments this seems to be working for me! |
@gcv, I'm curious to know is desktop-save interoperability/support on your list for future changes? |
@nickgarber: Thank you for testing! I think I'll add support for a custom I'm reluctant to use About |
Your points in the first and second paragraph sound wholly sensible to me.
and (just a mention), I've also started testing this config alongside
and this all seems to be going well. Perspective (+projectile) allows me to:
In particular, it's required to efficiently deliver on tasks that are prone to preemption. When the Put simply, it means the mental safety-net can catch more preempted project work. In the case of Couple questions:
Thanks! |
I just pushed some changes to support Please test. 😁 It's definitely possible to extend For psession integration: as far as I can tell, the only things it restores that |
Hi from Reddit! I'm trying this out. I have set the
Can you advise? Thanks! |
Thank you for testing. I'll need your help to track this down. Please evaluate the following code (using ielm for example):
Does that crash with the same args out of range? If it does then run this:
If all that succeeds, run this:
PS: What version of Emacs? |
Hello, apologies for the delay. I changed my config over to use With my new config I can't recreate the error. I can try and use my old config if you want to track it down? When I use
Overall this works really well and is basically exactly what I was looking for so thanks for your work. |
Lots of good feedback here.
I'm a bit swamped, but I'll try to find time to work on these improvements soon. Thanks for testing! |
No worries! I will try those things for lazy loading. Here's my ivy/counsel config
|
@tbtommyb: I just updated this PR with a commit enabling saving and restoring dired-mode buffers and windows. Seems to work for me. Could you please test it? I looked into the Ivy strange display thing. It seems to be an artifact of the way |
Yep, works nicely! One other thing I've noticed is that I tend to leave lots of buffers open and also use flycheck. This means that restoring state can take quite a long time (15-20 seconds on a MBP). Maybe this is fine and inevitable because of how I do things. Personally I wouldn't expect perspective to reload anything more than the visible buffers but I guess it depends on how you use emacs. Anyway the functionality seems to be all there, thanks! |
@gcv sorry but why didn't we use desktop-mode functionality? ( I tried it but didn't work)
@gcv desktop-mode had desktop-restore-eager’s value is t
Documentation:
Number of buffers to restore immediately.
Remaining buffers are restored lazily (when Emacs is idle).
If value is t, all buffers are restored immediately. |
desktop-mode predates perspective by a fair bit, and I don't see any non-fragile way to extend it. I'm certainly open to extending |
I haven't try you patch, but are you aware of shell buffers restoration?. is this patch can restore shell buffers? and, I saw some unmerged pr, are waiting for nex3 review/suggestion, or just waiting for tests? |
At this point, nex3 does not have time to work on this project. @zenspider and I have just received commit access, although we have not yet worked out the patch review process between us. As for restoring shell buffers: the patch does not restore them at the moment, though I can probably add support for eshell specifically. Have to think about that one. Supporting term.el or vterm buffers is unlikely. |
Is shell will be supported, I use shell-here all the time, really need this. |
@azzamsa maybe I don't understand... It looks to me like |
@azzamsa: I'm reluctant to add support for shell-mode, because it will be unreliable. The whole point of saving shell buffer state is to restore the shell with the same current working directory, but shell-mode does not have good directory tracking: https://www.gnu.org/software/emacs/manual/html_node/emacs/Directory-Tracking.html#Directory-Tracking The As I said, supporting eshell should not be a problem, as it does a good job of keeping |
@gcv okay great. https:/ffevotte/desktop-plus maybe this project can give you some glimpse. |
@azzamsa: Thanks for the reference link. I looked at it. |
Haha I hope that experiment didn't take much of your productive time. Just leave shell-mode support if that so difficult to deal with. |
Heads up for anyone following this PR: I rebased the underlying branch on top of the current mainline master and force-pushed. Reason: (1) some unrelated commits accidentally made it to this feature branch and I wanted to remove them, and (2) mainline recently acquired the ability to write automated tests, and I wanted to write tests for this feature before merging it in. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one is a lot. As such, I don't think my review is really comprehensive enough.
Dunno if this should be a comment review or a request changes or what.
persps-in-frame))))) | ||
(make-persp--state-frame | ||
:persps persps-in-frame | ||
:order persp-names-in-order))))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sames... maybe I'm just agitating for a TODO: refactor / clean?
comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was documented here: https:/gcv/perspective-el/blob/4a0fe25/perspective.el#L1000-L1027
I'm certainly open to suggestions, but I don't see any way to simplify the code. It just takes Emacs' representation of window layouts, does a bit of transformation on unpersistable buffers, puts the result in a struct, and writes the struct to disk.
Match is amazing : https://docs.racket-lang.org/reference/match.html#%28form._%28%28lib._racket%2Fmatch..rkt%29._match%29%29
… On Oct 23, 2019, at 15:31, gcv ***@***.***> wrote:
@gcv commented on this pull request.
In perspective.el:
> + (cons 'leaf
+ (cl-loop for prop in leaf-props
+ collect (if (not (eq 'buffer (car prop)))
+ prop
+ (lexical-let ((bn (cadr prop)))
+ (if (member bn valid-buffers)
+ prop
+ (cons 'buffer
+ (cons (lexical-let ((scratch-persp (format "*scratch* (%s)" persp)))
+ (if (get-buffer scratch-persp)
+ scratch-persp
+ "*scratch*"))
+ (cddr prop))))))))))
+ ;; recurse
+ (t (cons (car entry) (cl-loop for e in (cdr entry)
+ collect (persp--state-window-state-massage e persp valid-buffers))))))
What is match?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Shit. Looks like my merges conflict with this. Sorry. I should have gotten this merged first since it is bigger / harder. Once you rebase, please merge. We need this complexity in master and behind us. |
Solves problems when persp-state-save is in kill-emacs-hook.
No big deal. It was a very minor conflict. |
This is an attempt to add support for durable perspectives. I often have many open, with many buffers and windows in each. Restarting Emacs with so much state (for upgrades or just instability reasons) is really painful.
This has no dependencies aside from perspective-el itself. It provides no integration with desktop-save-mode, though I imagine few persp-mode users rely on it since it doesn't really do the right thing.
It works with my Emacs setup, but definitely needs testing with other people's configurations.