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

Is there anything like `ivy-save-view' ? #1079

Closed
paul-xie-rs opened this Issue Jun 23, 2017 · 3 comments

Comments

Projects
None yet
2 participants
@paul-xie-rs
Copy link

paul-xie-rs commented Jun 23, 2017

I use ivy-push-view to save the windows layout. It's very useful for me. But when I restart my Emacs. The views are all lost. Can I do something to save the views to file and load them again when restart Emacs?

@abo-abo

This comment has been minimized.

Copy link
Owner

abo-abo commented Jun 23, 2017

You can save the current state of the ivy-views variable to your config. That's about it.
It might be useful to have a command to save it, but a lot of decisions have to be made:

  • Where to put the file (probably, ~/.emacs.d/); maybe there's some API for this, I don't know
  • How to name the file
  • What to do with entries for files that don't exist any more
  • How often to save to the file

It's doable in general, but maybe it's better to leave it up to the user to configure it to their preference. Or maybe have a separate package like ivy-save-view-mode (akin to recentf-mode) that lets the user configure everything to their liking without bloating ivy.el too much.

@paul-xie-rs

This comment has been minimized.

Copy link
Author

paul-xie-rs commented Jun 25, 2017

Thank you. Sometimes I just need to restart Emacs. But I don't want to lost all of my ivy-views. So I wrote some functions to do this:

(defun peng-save-ivy-views ()
(interactive)
(with-temp-file "~/.emacs.d/ivy-views"
(prin1 ivy-views (current-buffer))
(message "save ivy-views to ~/.emacs.d/ivy-views")))

(defun peng-load-ivy-views ()
(interactive)
(setq ivy-views
(with-temp-buffer
(insert-file-contents "~/.emacs.d/ivy-views")
(read (current-buffer))))
(message "load ivy-views"))

It enough for me.

Thank you very much.

@abo-abo

This comment has been minimized.

Copy link
Owner

abo-abo commented Jun 25, 2017

You're welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.