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

Ability to save window layout and persist between sessions #2832

Closed
robbyoconnor opened this issue Aug 31, 2015 · 17 comments
Closed

Ability to save window layout and persist between sessions #2832

robbyoconnor opened this issue Aug 31, 2015 · 17 comments

Comments

@robbyoconnor
Copy link
Contributor

It would be super neat if we could save our window layout and persist it between sessions. Making an issue just in case anyone wants it...also to open a dialogue :)

@TheBB
Copy link
Contributor

TheBB commented Aug 31, 2015

I think this is essentially desktop-save-mode? Some people have tried to get it working, but it seems more difficult than normal, for some reason.

#1265 #1112

@robbyoconnor
Copy link
Contributor Author

Ah -- I tried to a search -- but I guess my keywords sucked...

@ghost
Copy link

ghost commented Aug 31, 2015

It seems there's some setup for this in spacemacs' config.el, which is disabled...

@robbyoconnor
Copy link
Contributor Author

so it seems...I guess having this issue isn't going to harm things...I don't know why it's commented out...probably because it doesn't play well...and breaks things...

@bmag
Copy link
Contributor

bmag commented Aug 31, 2015

Well, config.el says about the desktop configuration that "The following code is kept as reference" (line 281).
There is also some minimal config in packages.el (lines 453-459) that just makes sure the desktop file is saved in the cache directory.

I have used desktop-save-mode several times manually - desktop-save before exiting spacemacs, then desktop-read after re-opening spacemacs. I didn't encounter any problems, and the window layout was indeed restored. However, I don't enable desktop-save-mode automatically in my config, so I can't say about using it full time.

@robbyoconnor
Copy link
Contributor Author

@bmag was it in spacemacs?

@bmag
Copy link
Contributor

bmag commented Aug 31, 2015

yes

@robbyoconnor
Copy link
Contributor Author

This comment is strictly for reference, once #1958 is merged into develop, I think this can be safely closed.

@Kethku
Copy link
Contributor

Kethku commented Aug 31, 2015

I bound some custom bindings to desktop-save-in-desktop-dir and desktop-read which I manually run whenever I need it. In my experience these have worked fine, but the automatic saving and loading does not seem to work from desktop-save-mode. No error, but it doesn't reload the window layout.

@syl20bnr
Copy link
Owner

@bmag would be cool to be able to save multiple sessions and listing them on the home buffer.

@bmag
Copy link
Contributor

bmag commented Aug 31, 2015

@syl20bnr if you're talking about sessions as understood by the desktop package (i.e. also restore buffers), then I don't know if it's possible, but it might be. If you're talking about window-purpose, then we should talk about window layouts (without restoring buffers), and yes it can be done.

@StreakyCobra
Copy link
Contributor

spacemacs-layout is now in develop ☺️

@tuhdo
Copy link
Contributor

tuhdo commented Dec 3, 2015

persp-mode is an alternative version of perspective. It can do everything perspective does, plus saving your workspaces and the layouts in them across session. When you open Emacs again, previous workspace with its layout and visible buffers are loaded accordingly.

@tuhdo
Copy link
Contributor

tuhdo commented Dec 3, 2015

Here is my configuration for persp-mode:

(defun tuhdo/init-persp-mode ()
  (use-package persp-mode
    :init
    (setq persp-save-dir spacemacs-cache-directory)
    (setq persp-lighter "")
    (evil-leader/set-key
      "Ll"  'persp-load-state-from-file
      "Ls"  'persp-save-state-to-file
      "La"  'persp-add-buffer
      "LA"  'persp-set-buffer
      "Lc"  'persp-kill
      "Lk"  'persp-remove-buffer
      "Ln"  'persp-next
      "Lp"  'persp-prev
      "Lr"  'persp-rename
      "Ls"  'persp-switch)
    (with-eval-after-load 'persp-mode
      (with-eval-after-load 'window-numbering
        (define-key window-numbering-keymap (kbd "M-1") 'persp-add-buffer)
        (define-key window-numbering-keymap (kbd "M-2") 'persp-remove-buffer)
        (define-key window-numbering-keymap (kbd "M-3") 'persp-prev)
        (define-key window-numbering-keymap (kbd "M-4") 'persp-next)
        (define-key window-numbering-keymap (kbd "M-5") 'persp-switch))
      (define-key persp-mode-map (kbd "M-1") 'persp-prev)
      (define-key persp-mode-map (kbd "M-2") 'persp-next))))

@tuhdo
Copy link
Contributor

tuhdo commented Dec 3, 2015

I've just realized that Spacemacs already included persp-mode in develop. Woot. I'm so outdated with Spacemacs development already.

@syl20bnr
Copy link
Owner

syl20bnr commented Dec 3, 2015

@Thudo spacemacs layouts are persp-mode perspectives, there are a couple of new dotfile variable for layouts, also check the README of the spacemacs layout layer (which is included in the spacemacs distribution).

@mooreniemi
Copy link

@tuhdo thanks for sharing your config. my only tweak was to change the mapping for switch, as it was shadowing save.

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

8 participants