Префиксный ключ emacs и рабочие группы2

863
CodeKingPlusPlus

Я пытаюсь использовать рабочие группы2, которые я установил из встроенного менеджера пакетов emacs elpa. Из файла readme:

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

Обратите внимание, что я использую emacs 24.3 и Ubuntu 12.04 LTS

  1. Каков префиксный ключ для этой ситуации?

Мы очень ценим любую помощь, и дайте мне знать, если вам нужно больше информации!

РЕДАКТИРОВАТЬ: Workgroups2 не загружается, когда я запускаю emacs. Он не распознает ни одну из команд. Это работает только после того, как я запустил emacs, и если я перезагрузил свой .emacsфайл, и если у меня есть следующее в моем .emacsфайле:

(autoload 'workgroups-mode "workgroups2") 

Как мне получить emacs для автоматической загрузки рабочих групп? Я бы подумал, что вышесказанного было бы достаточно. Стоит отметить, что я скачал рабочие группы2 из melpa и мне не нужно ничего этого ...

1

2 ответа на вопрос

3
Sergey

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

Installation

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

Notes

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)" 
Вы должны проверить мой другой пост: http://superuser.com/questions/635013/emacs-workgroups-and-interpreters CodeKingPlusPlus 10 лет назад 0
2
Aaron Miller

Ключ префикса определяется пользователем модуля, а не указывается автором модуля. Согласно readme для workgroups2, установка собственного префиксного ключа является частью настройки модуля:

конфигурировать

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

Проверьте мои изменения. Рабочие группы не загружаются при запуске emacs, и я не могу понять, как его получить ... CodeKingPlusPlus 10 лет назад 0
@CodeKingPlusPlus Рассмотрим [этот ответ из аналогичной ситуации] (http://superuser.com/a/631938/162434) - часто полезно явно вызывать `(package-initialize)` в какой-то момент во время инициализации, чтобы ELPA пакеты загружаются до завершения init и после этого могут управляться обычным способом. Aaron Miller 10 лет назад 0

Похожие вопросы