What is the best Emacs workspaces plugin?

axel22 picture axel22 · Jun 29, 2012 · Viewed 7.8k times · Source

By workspace, I mean - I need to save the state of my open buffers (possibly in a user specified workspace file) and quickly switch to another set of open buffers, e.g. to continue working on files related to another project.

Is there an Emacs plugin which allows this? Which one would you recommend?

Answer

jpkotta picture jpkotta · Jun 29, 2012

I use a combination of save-visited-files and workgroups. In fact, workgroups will probably do most of what you want by itself.

My config:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; workgroups for windows

(setq wg-prefix-key (kbd "C-c z")
      wg-no-confirm t
      wg-file (concat emacs-persistence-directory "workgroups")
      wg-use-faces nil
      wg-switch-on-load nil)

(defun wg-load-default ()
  "Run `wg-load' on `wg-file'."
  (interactive)
  (wg-load wg-file))

(defun wg-save-default ()
  "Run `wg-save' on `wg-file'."
  (interactive)
  (when wg-list
    (with-temp-message ""
      (wg-save wg-file))))

(with-library 'workgroups
  (define-key wg-map (kbd "C-l") 'wg-load-default)
  (define-key wg-map (kbd "C-s") 'wg-save-default)
  (workgroups-mode 1)
  (add-hook 'auto-save-hook 'wg-save-default)
  (add-hook 'kill-emacs-hook 'wg-save-default))