Skip to content
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

Feature request: defer perspective loading? #157

Open
titibandit opened this issue Jul 7, 2021 · 2 comments
Open

Feature request: defer perspective loading? #157

titibandit opened this issue Jul 7, 2021 · 2 comments

Comments

@titibandit
Copy link
Contributor

Hey,
I have one of my perspective, that is filled with tramp buffers over ssh.
I have it in my init.el that perspectives are automatically loaded on start.
This leads to two problems:

  • If my ssh server happens to be offline, loading the buffers times out and this destroys all my perspectives.
  • If my ssh server is online, perspectives load fine, but it takes a looooong time, even if I don't intend to work on these tramp buffers.

Would there be a way to defer the loading of the perspective until we actually switch to that perspective? That would actually speed up the loading of the perspectives, even if one doesn't have many tramp buffers.
Or if there is another solution to my problem, I'm all ears :)
Cheers,

@gcv
Copy link
Collaborator

gcv commented Jul 7, 2021

Good idea! I don't have time to work on it myself right now, but would gladly review a patch.

The approach is something like this:

  • Introduce a new (defcustom persp-state-defer-loading nil ...).
  • Introduce a new data structure to keep track of loaded and deferred perspectives. It should be a map of frame -> perspective -> (loaded flag, list of files).
  • Refactor persp-state-load to call helper functions which do the work of actually opening files depending on the value of persp-state-defer-loading.
  • Refactor persp-switch. If persp-state-defer-loading is t, it should check the new data structure: if it has not yet been loaded, mark it as loaded and call the new helper functions to load the files.
  • Add tests for this new behavior. 🙃

@gcv gcv added the enhancement label Jul 7, 2021
@titibandit
Copy link
Contributor Author

Thanks @gcv for the "implementation tutorial"!
I'm also struggling with time at the moment (hence why I want my emacs to load faster!) and I'm not the best elisp programmer yet, I'll try to give a go at implementing that, later down the line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants