I am trying to use workgroups2 which I installed from the builtin emacs package manager elpa. From the readme file:

Most commands are bound to both <prefix> <key> and <prefix> C-<key>.

<prefix> <key>
<prefix> c    - create workgroup
<prefix> k    - kill workgroup
<prefix> v    - switch to workgroup
<prefix> C-s  - save session
<prefix> C-f  - load session


Type <prefix> ? (Eval (wg-help)) for more help.

This will bring up a help buffer listing all the commands and their bindings.

See the customization section in the source for details, or use:

M-x customize-group RET workgroups RET

Note that I use emacs 24.3 and Ubuntu 12.04 LTS

  1. What is the prefix key for this situation?

All help is greatly appreciated, and let me know if you need more information!

EDIT: Workgroups2 is not loading when I start emacs. It will not recognize any of the commands. It only works after I have started emacs and if I reload my .emacs file and if I have the following in my .emacs file:

(autoload 'workgroups-mode "workgroups2")

How do I get emacs to automatically load workgroups? I would have thought that the above would have sufficed. It is worth noting that I downloaded workgroups2 from melpa and I should not need any of this...


Answering the question

Aaron was right. This line is responsible for the prefix key:

(setq wg-prefix-key (kbd "C-c z"))     ;; and it's by default now

So for example - if you want to create a workgroup - press C-c z c


It's better to compile extension files.

I made installation easier - just install the extension and put these lines somewhere in the end of ".emacs". That's all.

(require 'workgroups2)
;; change some settings
(workgroups-mode 1)

Note that if you use emacs --daemon - disable automatic loading of workgroups:

(setq wg-use-default-session-file nil)

And load them manually (when creating a frame).


I checked this extension under Ubuntu (latest Emacs from git repo) and Windows (Emacs 24.3)

To Aaron:
Aaron, I've just disabled these remappings by default (I simply didn't face this problem)

To all:

  1. It's better to post bugs on Github
  2. (not a real excuse) But please consider that this extension was taken from the experimental branch and most of the code wasn't written by me.
  3. If you're a good Emacs hacker - you are always welcome to fix the code and be a collaborator (in order not to repeat the fate of the original repo)

Test tips

If you want to check only workgroups2 extension:

Assuming you have extracted it under ~/.emacs.d/elisp/extensions/ use this command:

emacs -Q -L ~/.emacs.d/elisp/extensions/workgroups2/src -l cl.el -l workgroups2.el --eval '(workgroups-mode 1)'

with ido.el:

emacs -Q -L ~/.emacs.d/elisp/extensions/workgroups2/src -l cl.el -l ido.el -l workgroups2.el --eval "(ido-mode t)" --eval "(workgroups-mode 1)"

The prefix key is defined by the module's user, rather than being specified by the module author. According to the workgroups2 readme, setting your own prefix key is part of configuring the module:


Load a module (if you installed it not from Melpa):

(add-to-list 'load-path "~/.emacs.d/extensions/workgroups2")
(require 'workgroups2)

and set some parameters:

;; Settings:
(desktop-save-mode t)     ; save all opened files (or disable it)
(setq wg-prefix-key (kbd "C-c z")
      wg-restore-associated-buffers nil ; restore all buffers opened in this WG?
      wg-use-default-session-file nil   ; turn off for "emacs --daemon"
      wg-default-session-file "~/.emacs_files/workgroups"
      wg-use-faces nil
      wg-morph-on nil)                  ; animation off

;; Keyboard shortcuts - load, save, switch
(global-set-key (kbd "<pause>")     'wg-reload-session)
(global-set-key (kbd "C-S-<pause>") 'wg-save-session)
(global-set-key (kbd "s-z")         'wg-switch-to-workgroup)
(global-set-key (kbd "s-/")         'wg-switch-to-previous-workgroup)

(workgroups-mode 1)     ; Activate workgroups

The line of particular interest here is this one:

(setq wg-prefix-key (kbd "C-c z")

This is where the prefix key is defined. Do you have such a line in your Emacs initialization code somewhere? If not, add one, somewhere prior to where workgroups-mode is activated via (workgroups-mode 1), and you should be good to go.

Tested with a fresh install of the workgroups2 package on GNU Emacs 24.3. (And I wish I hadn't, because the stupid thing hijacked C-x C-<left> and C-x C-<right>!)

  • Check out my edit. Workgroups is not loaded when emacs starts and I cannot figure out how to get it too... – CodeKingPlusPlus Aug 21 '13 at 20:25
  • @CodeKingPlusPlus Consider this answer from a similar situation -- it's often useful to explicitly call (package-initialize) at some point during initialization, so that ELPA packages get loaded before init is finished and can thereafter be managed in the usual fashion. – Aaron Miller Aug 21 '13 at 20:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.