Skip to content

pashinin/workgroups2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Workgroups2

https://github.com/pashinin/workgroups2/actions/workflows/test.yml/badge.svg http://melpa.org/packages/workgroups2-badge.svg http://stable.melpa.org/packages/workgroups2-badge.svg

This program can save&load multiple named workspaces (or “workgroups”),

  • Save all opened buffers, their location and sizes on disk to restore later
  • Restore special buffers as: org-agenda, shell, magit-status, help, pdf-tools
  • Users can set up to support any special buffer (restoring the page number and notes of pdf file, for example)

Fork it, add more special buffers support. Or even better - fix bugs.

Install

Just install “workgroups2” from Melpa and activate it with

(require 'workgroups2)

Usage

Quick Start

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.

Enable minor mode workgroups-mode (OPTIONAL)

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

Tips (OPTIONAL)

Change workgroups session file

Use below code

(setq wg-session-file "~/.emacs.d/.emacs_workgroups")

Support special buffer

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))))))

FAQ

Simon Michael (AKA) has written a nice FAQ.

License

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.