pashinin / workgroups2

Workgroups2 - Emacs session manager
http://workgroups2.rtfd.org/
GNU General Public License v3.0
297 stars 43 forks source link

How to automatically perform wg-save-session? #93

Closed fu123456 closed 3 years ago

fu123456 commented 4 years ago

It seems to only execute "wg-save-session" command by my hand, which can save sessions. So I want to automatically auto save sesstions to my file ".emacs_workgroup". My config is

;; What to do on Emacs exit / workgroups-mode exit?
(setq wg-emacs-exit-save-behavior           'save)      ; Options: 'save 'ask nil
(setq wg-workgroups-mode-exit-save-behavior 'save)      ; Options: 'save 'ask nil

It does not work. How to solve this issue.

redguardtoo commented 4 years ago

maybe (wg-save-session t) in auto-save-hook?

fu123456 commented 4 years ago

I add the below code to my config:

;; auto save wg-save-session
(add-hook 'auto-save-hook 'wg-save-session t)

But it does not work.

redguardtoo commented 4 years ago

Sorry, it's my typo, should be after-save-hook,

(defun after-save-hook-setup ()
  (wg-save-session t))
(add-hook 'after-save-hook 'after-save-hook-setup)

Personally I don't like auto save the sub-windows layout. I might change the layout temporarily. The temp layout should not be saved.

redguardtoo commented 3 years ago

Now it's all handled automatically.