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?
是否有一个Emacs插件允许这样做?你推荐哪一种?
5 个解决方案
#1
10
I use a combination of save-visited-files and workgroups. In fact, workgroups will probably do most of what you want by itself.
我使用了save- visitedfiles和工作组的组合。事实上,工作组可能会自行完成您想要的大部分工作。
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))
#2
5
Personally, I've been using `persp-mode':
就我个人而言,我一直在使用“出汗模式”:
Perspectives for emacs, based on
perspective-el
by Nathan Weizenbaum. But perspectives shared among frames + ability to save/restore from/to file.emacs的视角,基于Nathan Weizenbaum的透视el。但是框架之间共享的透视图+保存/恢复文件的能力。
#3
2
desktop.el will be helpful in your situation.
桌面。埃尔对你的情况会有帮助的。
It can (copied from its introduction page) from the emacs packages buffer:
它可以(从它的介绍页面复制)从emacs包缓冲区:
Save the Desktop, i.e., - some global variables - the list of buffers with associated files. For each buffer also - the major mode - the default directory - the point - the mark & mark-active - buffer-read-only - some local variables
保存桌面,即。, -一些全局变量-带有相关文件的缓冲区列表。对于每个缓冲区—主模式—默认目录—点—标记-活动-缓冲-只读—一些本地变量
#4
2
If you are using Linux/Gnome3, you can try this extension: https://extensions.gnome.org/extension/361/emacs-manager/ This extension will allow you to work on different projects simultaneously by managing multiple emacs daemons, and save/restore state of buffers.
如果您正在使用Linux/Gnome3,您可以尝试这个扩展:https://extensions.gnome.org/extension/361/emacs-manager/这个扩展将允许您同时处理不同的项目,方法是管理多个emacs守护进程,并保存/恢复缓冲区的状态。
#5
2
HIROSE Yuuji's revive.el has worked nicely for me for quite some time. I use the standard configuration presented in the comments in revive.el. The documentation is well written and revive is very easy to use and configure. In particular, revive.el has better support than some for reviving configurations that are a bit more complex. It is particularly nice if you combine it with the HIROSE Yuuji's windows.el. They are made to work together. windows.el makes it possible to recall window splits, etc. revive.el is built with an eye toward extensibility toward deeper mode integration for particular setups. But for my uses, I have found it to be quite nice out of the box, though I think I'll next tweak it to revive w3m windows which I currently don't have setup (Update: I do now: see bottom).
HIROSE Yuuji的恢复。埃尔很好地为我工作了一段时间。我使用了revive.el中给出的标准配置。文档写得很好,复活非常容易使用和配置。特别是,恢复。与其他一些支持恢复稍微复杂一点的配置相比,el有更好的支持。如果你把它和HIROSE Yuuji的窗户结合在一起会特别好。他们被安排在一起工作。窗户。el使它有可能回忆窗口分裂等复活。el的构建着眼于针对特定设置的更深入模式集成的可扩展性。但是对于我的使用,我发现它非常好用,尽管我想我将继续修改它以恢复w3m windows,我目前还没有安装(更新:我现在做:见下)。
Here is my revive config. I include some helpful comments, first for windows.el and then revive.el inline:
这是我的复活配置。我首先为windows添加了一些有用的注释。el然后重启。el内联:
(provide 'my-revive-config)
(require 'windows) ; use this with revive so that window splits are recallable
; too
(win:startup-with-window) ; start with window 1
;;;[Key Bindings]
;;;
;;; The default prefix key stroke for Windows is `C-c C-w'. If it
;;; causes you some troubles, see the section `Customizations'.
;;; Here are the default key bindings.
;;;
;;; C-c C-w 1 Switch to window 1 (Q)
;;; C-c C-w 2 Switch to window 2 (Q)
;;; :
;;; C-c C-w 9 Switch to window 9 (Q)
;;; C-c C-w 0 Swap windows with the buffer 0 (Q)
;;; (Select unallocated frame(Emacs 19))
;;; C-c C-w SPC Switch to window previously shown (Q)
;;; C-c C-w C-n Switch to next window
;;; C-c C-w C-p Switch to previous window
;;; C-c C-w ! Delete current window (Q)
;;; C-c C-w C-w Window operation menu
;;; C-c C-w C-r Resume menu
;;; C-c C-w C-l Local resume menu
;;; C-c C-w C-s Switch task
;;; C-c C-w = Show window list (Q)
;;;
;;; The key strokes to select windows from 1 to 9 must be
;;; frequently used, so the alternative key strokes `C-c [Num.]' are
;;; available by default (And any function with (Q)mark can be
;;; invoked without C-w). To disable these quick key strokes, set
;;; the variable win:quick-selection to `nil' in your ~/.emacs.
(autoload 'save-current-configuration "revive" "Save status" t)
(autoload 'resume "revive" "Resume Emacs" t)
(autoload 'wipe "revive" "Wipe Emacs" t)
(define-key ctl-x-map "S" 'save-current-configuration)
(define-key ctl-x-map "F" 'resume)
(define-key ctl-x-map "K" 'wipe)
;;;
;;;[How to use]
;;;
;;; Call `save-current-configuration' (`C-x S' if you define key as
;;; above) when you want to save current editing status and call
;;; `resume' to restore it. Numerical prefix arg to them specifies
;;; the buffer number in which the editing status will be saved.
;;; Here the buffer refers to a revive s-exp in ~/.revive.el of
;;; which there can be n
;;;
;;; [Sample Operations]
;;; C-u 2 C-x S ;save status into the buffer #2
;;; C-u 3 C-x F ;load status from the buffer #3
There are variants of this that others like revive-plus.el and a slightly modified clone on github, but I prefer the original.
还有其他的版本,比如viv -plus。el和github上稍作修改的克隆,但我更喜欢原版。
Update Monday, January 12, 2015: Now I can restore w3m in revive (see revive.el docs for details and in particular look at examples in revive:major-mode-command-alist-default):
更新时间:2015年1月12日星期一:现在我可以恢复w3m的生命。el文档的详细信息,特别是复苏的例子:major-mode- alist-default):
(setq revive:major-mode-command-alist-private
'(("*w3m*" . w3m)))
Notice you are telling revive the name of the w3m buffer. Even if you have multiple tabs, only the first one need be enumerated as above.
注意,您正在告诉恢复w3m缓冲区的名称。即使您有多个选项卡,也只需要如上所示列出第一个选项卡。
Here is the w3m variable I have set to restore all tabs from the previous session:
下面是我设置的w3m变量,用于恢复上一届会议的所有选项卡:
(setq w3m-session-load-last-sessions t)
#1
10
I use a combination of save-visited-files and workgroups. In fact, workgroups will probably do most of what you want by itself.
我使用了save- visitedfiles和工作组的组合。事实上,工作组可能会自行完成您想要的大部分工作。
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))
#2
5
Personally, I've been using `persp-mode':
就我个人而言,我一直在使用“出汗模式”:
Perspectives for emacs, based on
perspective-el
by Nathan Weizenbaum. But perspectives shared among frames + ability to save/restore from/to file.emacs的视角,基于Nathan Weizenbaum的透视el。但是框架之间共享的透视图+保存/恢复文件的能力。
#3
2
desktop.el will be helpful in your situation.
桌面。埃尔对你的情况会有帮助的。
It can (copied from its introduction page) from the emacs packages buffer:
它可以(从它的介绍页面复制)从emacs包缓冲区:
Save the Desktop, i.e., - some global variables - the list of buffers with associated files. For each buffer also - the major mode - the default directory - the point - the mark & mark-active - buffer-read-only - some local variables
保存桌面,即。, -一些全局变量-带有相关文件的缓冲区列表。对于每个缓冲区—主模式—默认目录—点—标记-活动-缓冲-只读—一些本地变量
#4
2
If you are using Linux/Gnome3, you can try this extension: https://extensions.gnome.org/extension/361/emacs-manager/ This extension will allow you to work on different projects simultaneously by managing multiple emacs daemons, and save/restore state of buffers.
如果您正在使用Linux/Gnome3,您可以尝试这个扩展:https://extensions.gnome.org/extension/361/emacs-manager/这个扩展将允许您同时处理不同的项目,方法是管理多个emacs守护进程,并保存/恢复缓冲区的状态。
#5
2
HIROSE Yuuji's revive.el has worked nicely for me for quite some time. I use the standard configuration presented in the comments in revive.el. The documentation is well written and revive is very easy to use and configure. In particular, revive.el has better support than some for reviving configurations that are a bit more complex. It is particularly nice if you combine it with the HIROSE Yuuji's windows.el. They are made to work together. windows.el makes it possible to recall window splits, etc. revive.el is built with an eye toward extensibility toward deeper mode integration for particular setups. But for my uses, I have found it to be quite nice out of the box, though I think I'll next tweak it to revive w3m windows which I currently don't have setup (Update: I do now: see bottom).
HIROSE Yuuji的恢复。埃尔很好地为我工作了一段时间。我使用了revive.el中给出的标准配置。文档写得很好,复活非常容易使用和配置。特别是,恢复。与其他一些支持恢复稍微复杂一点的配置相比,el有更好的支持。如果你把它和HIROSE Yuuji的窗户结合在一起会特别好。他们被安排在一起工作。窗户。el使它有可能回忆窗口分裂等复活。el的构建着眼于针对特定设置的更深入模式集成的可扩展性。但是对于我的使用,我发现它非常好用,尽管我想我将继续修改它以恢复w3m windows,我目前还没有安装(更新:我现在做:见下)。
Here is my revive config. I include some helpful comments, first for windows.el and then revive.el inline:
这是我的复活配置。我首先为windows添加了一些有用的注释。el然后重启。el内联:
(provide 'my-revive-config)
(require 'windows) ; use this with revive so that window splits are recallable
; too
(win:startup-with-window) ; start with window 1
;;;[Key Bindings]
;;;
;;; The default prefix key stroke for Windows is `C-c C-w'. If it
;;; causes you some troubles, see the section `Customizations'.
;;; Here are the default key bindings.
;;;
;;; C-c C-w 1 Switch to window 1 (Q)
;;; C-c C-w 2 Switch to window 2 (Q)
;;; :
;;; C-c C-w 9 Switch to window 9 (Q)
;;; C-c C-w 0 Swap windows with the buffer 0 (Q)
;;; (Select unallocated frame(Emacs 19))
;;; C-c C-w SPC Switch to window previously shown (Q)
;;; C-c C-w C-n Switch to next window
;;; C-c C-w C-p Switch to previous window
;;; C-c C-w ! Delete current window (Q)
;;; C-c C-w C-w Window operation menu
;;; C-c C-w C-r Resume menu
;;; C-c C-w C-l Local resume menu
;;; C-c C-w C-s Switch task
;;; C-c C-w = Show window list (Q)
;;;
;;; The key strokes to select windows from 1 to 9 must be
;;; frequently used, so the alternative key strokes `C-c [Num.]' are
;;; available by default (And any function with (Q)mark can be
;;; invoked without C-w). To disable these quick key strokes, set
;;; the variable win:quick-selection to `nil' in your ~/.emacs.
(autoload 'save-current-configuration "revive" "Save status" t)
(autoload 'resume "revive" "Resume Emacs" t)
(autoload 'wipe "revive" "Wipe Emacs" t)
(define-key ctl-x-map "S" 'save-current-configuration)
(define-key ctl-x-map "F" 'resume)
(define-key ctl-x-map "K" 'wipe)
;;;
;;;[How to use]
;;;
;;; Call `save-current-configuration' (`C-x S' if you define key as
;;; above) when you want to save current editing status and call
;;; `resume' to restore it. Numerical prefix arg to them specifies
;;; the buffer number in which the editing status will be saved.
;;; Here the buffer refers to a revive s-exp in ~/.revive.el of
;;; which there can be n
;;;
;;; [Sample Operations]
;;; C-u 2 C-x S ;save status into the buffer #2
;;; C-u 3 C-x F ;load status from the buffer #3
There are variants of this that others like revive-plus.el and a slightly modified clone on github, but I prefer the original.
还有其他的版本,比如viv -plus。el和github上稍作修改的克隆,但我更喜欢原版。
Update Monday, January 12, 2015: Now I can restore w3m in revive (see revive.el docs for details and in particular look at examples in revive:major-mode-command-alist-default):
更新时间:2015年1月12日星期一:现在我可以恢复w3m的生命。el文档的详细信息,特别是复苏的例子:major-mode- alist-default):
(setq revive:major-mode-command-alist-private
'(("*w3m*" . w3m)))
Notice you are telling revive the name of the w3m buffer. Even if you have multiple tabs, only the first one need be enumerated as above.
注意,您正在告诉恢复w3m缓冲区的名称。即使您有多个选项卡,也只需要如上所示列出第一个选项卡。
Here is the w3m variable I have set to restore all tabs from the previous session:
下面是我设置的w3m变量,用于恢复上一届会议的所有选项卡:
(setq w3m-session-load-last-sessions t)