一些 emacs 桌面保存问题:如何更改为保存在 ~/.emacs.d/.emacs.desktop
我在 init.el 中设置了这个设置
(desktop-save-mode 1)
,效果很好,只是我想知道:
如何更改它以将 .emacs.desktop 文件保存到 ~/.emacs.d 而不是 ~/
如何阻止它询问我是否要保存(仅在我第一次关闭 emacs 后发生)重新启动,从那时起它假设是,这是我一直希望发生的情况)
I have this set in my init.el
(desktop-save-mode 1)
This works great, only I was wondering:
how can I change it to save the .emacs.desktop files into ~/.emacs.d instead of ~/
how can I stop it from asking me if I want to save (only occurs the first time I close emacs after a reboot, from then on it assumes yes, which is what I always want to happen)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我使用以下内容,这对我有用:
嗯,我实际上设置了
(desktop-save-mode 0)
,然后使用Mx my-desktop
来启动:但是这是因为我的会话经常超过 100 个文件,主要是通过 Tramp,所以我更喜欢将其加载为手动任务,而不是破坏桌面文件:)
我建议查看 Emacs Wiki:
http://www.emacswiki.org/emacs/DeskTop
对默认值有一些有用的增强功能。特别是,我建议添加一些在会话中自动保存桌面的方法,因为如果您的系统在 Emacs 运行了几天后崩溃并且您的桌面尚未保存,那么真的会很烦人在此期间。
从 Emacs 24.4 开始,默认情况下桌面文件会定期自动保存。请参阅
desktop-auto-save-timeout
变量(我也将其添加到上面的块中)。感谢 GDP2 和 Dexter Morgan 对此的评论。I use the following, which works for me:
Well, I actually set
(desktop-save-mode 0)
and then useM-x my-desktop
to kick things off:But that's because my session is frequently in excess of 100 files, mostly via tramp, and so I prefer to make loading it a manual task, and not clobber the desktop file otherwise :)
I recommend checking out the Emacs Wiki:
http://www.emacswiki.org/emacs/DeskTop
There are some useful enhancements to the default functionality. In particular, I recommend adding some method of auto-saving your desktop mid-session, as it's really annoying if your system crashes when Emacs has been running for several days, and your desktop hasn't been saved in the interim.
Since Emacs 24.4 the desktop file is auto-saved periodically by default. See the
desktop-auto-save-timeout
variable (which I've also added to the block above). Thanks to GDP2 and Dexter Morgan for their comments on this.自定义
desktop-dirname
变量。自定义
desktop-save
变量。Customize
desktop-dirname
variable.Customize
desktop-save
variable.想分享我的会议是如何组织的。
要求:
解决方案:
安装包(插件)workgroups2 -> https://github.com/pashinin/workgroups2
将以下 lisp 代码添加到您的 ~/. emacs.d/init.el 或 ~/.emacs:
->
函数
nk-server-start
在 emacs 启动时被调用。它有一个参数 - 会话名称。
我们可以通过从终端运行以下命令来启动 emacs-session
foo
:如果我们想从终端打开会话
foo
中的文件,我们需要运行:当我们关闭会话时,所有缓冲区、设置等保存在文件
~/.emacs-local/sessions/foo
当我们运行命令
setsid emacs --eval '(nk-server-start "foo") ' &
下次,所有缓冲区都将被恢复,因为命令很大而且我很懒:)我制作了一些脚本并将它们添加到我的
$PATH
中以缓解这个问题:< code>em_start_foo.sh - 运行会话,仅使用一次来启动会话
em_foo.sh
- 将文件添加到会话现在我们只需从终端运行:
当然多个会话可以并行运行。
假设我们还创建了脚本
em_start_foo_2.sh
、em_start_foo_2.sh
、em_start_foo_3.sh
、em_start_foo_3.sh
(当然是在$PATH
的某个地方)然后我们可以做这样的事情:
Package
workgroups2
真的很棒!我的带有会话选项的 emacs 初始化文件位于: https:// github.com/nexayq/dot_files/blob/master/emacs/dot_emacs_d/init.el
Wanted to share how my sessions are organized.
Requirements:
Solution:
Install package(plugin) workgroups2 -> https://github.com/pashinin/workgroups2
Add following lisp code to your ~/.emacs.d/init.el or ~/.emacs:
->
Function
nk-server-start
is called when emacs is started.It has one argument - sesssion name.
We can start emacs-session
foo
by running following command from terminal:If we want to open file in session
foo
from terminal we need to run:When we close session, all buffers,settings, etc. are saved in file
~/.emacs-local/sessions/foo
When we run command
setsid emacs --eval '(nk-server-start "foo")' &
next time, all buffers will be restoredBecause commands are large and I am lazy :) I made some scripts and added them to my
$PATH
in order to ease this:em_start_foo.sh
- Run session, used only once to start sessionem_foo.sh
- Add files to sessionNow we just run from terminal:
Multiple sessions can be run in parallel of course.
Let's say we created also scripts
em_start_foo_2.sh
,em_start_foo_2.sh
,em_start_foo_3.sh
,em_start_foo_3.sh
(somewhere in$PATH
of course)Then we can do something like this:
Package
workgroups2
is really great!My emacs init file with session options is available at: https://github.com/nexayq/dot_files/blob/master/emacs/dot_emacs_d/init.el