Workgroups is a session manager for Emacs.
- It saves all your opened buffers, their location and sizes on disk to restore later
- You can create several work groups
You can also restore such buffers as: org-agenda, shell, magit-status, help.
Fork it, add more special buffers support. Or even better - fix bugs.
Just install “workgroups2” from Melpa and activate it with
(require 'workgroups2)
Use M-x wg-create-workgroup
to save save window&buffer layout as a work group.
Use M-x wg-open-workgroup
to open an existing work group.
Use M-x wg-kill-workgroup
to delete an existing work group.
Put below line at the bottom of .emacs
,
(workgroups-mode 1)
Most commands are bound to both <prefix> <key>
and <prefix> C-<key>
.
By default prefix is: “C-c z” (To change it - see settings below)
<prefix> <key> <prefix> C-c - create a new workgroup <prefix> C-v - open an existing workgroup <prefix> C-k - delete an existing workgroup
If you want to set up this minor mode further:
(require 'workgroups2)
;; Change prefix key (before activating WG)
(setq wg-prefix-key "C-c z")
(workgroups-mode 1) ; put this one at the bottom of .emacs
Use below code
(setq wg-session-file "~/.emacs.d/.emacs_workgroups")
Here is minimum sample code to support ivy-occur-grep-mode
,
(with-eval-after-load 'workgroups2
;; provide major mode, package to require, and functions
(wg-support 'ivy-occur-grep-mode 'ivy
`((serialize . ,(lambda (_buffer)
(list (base64-encode-string (buffer-string) t))))
(deserialize . ,(lambda (buffer _vars)
(switch-to-buffer (wg-buf-name buffer))
(insert (base64-decode-string (nth 0 _vars)))
;; easier than `ivy-occur-grep-mode' to set up
(grep-mode)
;; need return current buffer at the end of function
(current-buffer))))))
workgroups2 is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
workgroups2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
This extension is based on experimental branch of the original repo.