abo-abo / swiper

Ivy - a generic completion frontend for Emacs, Swiper - isearch with an overview, and more. Oh, man!
https://oremacs.com/swiper/
2.29k stars 338 forks source link

Saving window layouts for future sessions #570

Open zeltak opened 8 years ago

zeltak commented 8 years ago

I tried to follow the examples on how to save window layouts for future sessions and now have this code in my init

(setq ivy-views '(
("boccaperta + ba-server [–]"
(vert
(sexp (bookmark-jump "boccaperta"))
(sexp (bookmark-jump "ba-server"))))

(("zbs"
(horz (vert ... ...)
(file "/home/zeltak/org/files/Uni/papers/paper.meta.org" 11587))))
))

the 2nd command "zbs" is copied from evaling ivy-views as you recommended in scratch.

when i issue ivy-pop view though only the boccaperta + ba-server [–] shows up.

im sure i messed/misunderstood something along the way, can you (gently :)) guide me in the right direction

thx!

Z

abo-abo commented 8 years ago

You need to remove one set of parens around the "zbs" entry.

Navigate to the beginning of the whole code and M-x indent-sexp - it will be easier to see where the error is.

zeltak commented 8 years ago

kk first of all thx for the indent-sexp tip! wasnt aware of that..its baby steps for me in coding ;-)

so that helped and now after taking out a set of parens it does show up correctly and when launched i do get the original splits yet when i saved the view with ivy-push-view each split had a different file. when i launch it back with ivy-pop-view all the split windows are empty. but maybe im missing the point and the ivy-push-view just save the window split+position and not the actual buffers open in them? my current config looks like this:

(setq ivy-views '(
          ("boccaperta + ba-server [–]"
           (vert
            (sexp (bookmark-jump "boccaperta"))
            (sexp (bookmark-jump "ba-server"))))

          ("zbs"
            (horz (vert ... ...)
              (file "/home/zeltak/org/files/Uni/papers/paper.meta.org" 11587)))
          ))

in any case this feature isnt that crucial to me so i dont want to waste your time to much with it ;-)

thx

Z

abo-abo commented 8 years ago

when i launch it back with ivy-pop-view all the split windows are empty.

ivy-pop-view is only used to delete a view.

To switch to a view, use ivy-switch-buffer and select "zbs".

zeltak commented 8 years ago

sorry i meant ivy-switch-buffer.

publicimageltd commented 7 years ago

I hoped this thread is about saving layouts without editing the init.el-file. Is that too complicated? I thought about using customize or something alike, and then save ivy-views each time we issue ivy-push-view. I'd love to have something like that. I know about "workgroups" and "perspectives", but this seems to be bloated -- ivy-views is all I'd want.

abo-abo commented 7 years ago

I hoped this thread is about saving layouts without editing the init.el-file. Is that too complicated?

The design of Emacs is that the behavior should not change unless you edit your init.el. Interfaces like customize simply save to your init.el.

There are a few packages that save their settings elsewhere, like projectile or multiple-cursors. I'll have to think about how Ivy can save the views in e.g. ~/.emacs.d/ivy-views.

publicimageltd commented 7 years ago

I agree, it would change the design logic of Ivy. But not on a second thought. Actually, there is already same saving going on, via recentf and autobookmarks. So why not include ivy-views as a kind of recentf (or stored bookmarks) for views? I could imagine it to work like autobookmarks, we could call it ivy-auto-views. If it is turned on, it stores ivy-views on exit, and it adds the stored list to ivy-views on startup (deleting duplicates).

zeltak commented 7 years ago

Hi

I would very much also love a "bookmark" feature for ivy-views. I love the simplicity of ivy-views but it was to complicated for me to manually config it for between session use. a internal way to save it as bookmarks would be fantastic for quick launching. i think that bookmark+ is very customizable in what it allows to save as a "bookmark" (such as lisp code etc) and thus maybe a good easy solution for this? best z

CSRaghunandan commented 7 years ago

A quick hack to get persistent views across sessions(if you use desktop-mode): append ivy-views to desktop-globals-to-save and when you restore from a saved desktop, ivy-views will also be restored :)

But, I'm sure there is much simpler way to do this than relying on desktop.

notuntoward commented 6 years ago

I'd also like to save ivy-views to disk. One thing that's not obvious to me is the method for saving indirect buffers. Any pointers on that?