emacs - 如何让emacs从初始目录自动加载和保存桌面?

标签 emacs

我通常同时处理 3-4 个不同的项目。所以我试图弄清楚如何让emacs从我打开emacs的文件夹中加载桌面,并在我退出该emacs实例时保存到该文件。

我看到的所有文档都描述了如何让 emacs 从默认位置自动打开和保存(这使得多个桌面成为不可能),或者手动加载桌面并将其保存到特定目录(我现在正在这样做)。

谢谢!

最佳答案

把它放到你的 .emacs 中:

(setq your-own-path default-directory)
(if (file-exists-p
     (concat your-own-path ".emacs.desktop"))
    (desktop-read your-own-path))

(add-hook 'kill-emacs-hook
      `(lambda ()
        (desktop-save ,your-own-path t)))

更新:v. 2,按需忽略。
(setq your-own-path default-directory)
(if (file-exists-p
     (concat your-own-path ".emacs.desktop"))
    (if (y-or-n-p "Read .emacs.desktop and add hook?")
    (progn
      (desktop-read your-own-path)
      (add-hook 'kill-emacs-hook
            `(lambda ()
               (desktop-save ,your-own-path t))))))

关于emacs - 如何让emacs从初始目录自动加载和保存桌面?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24921390/

相关文章:

emacs - 如何在 minibuffer 中输入一个空格而不是完成一个单词?

logging - Emacs 口齿不清 : How to use ad-get-arg and ad-get-args?

windows - Flymake 在 Windows Emacs 上不适合我

emacs - emacs lisp 中符号名和变量名的区别

javascript - js2 模式中的 Linting 错误似乎*不是*来自 Flycheck?

emacs - 如何在 emacs 中获得没有返回类型的函数的正确缩进?

emacs - 使用 SLIME 在远程 Emacs 上完成 Tab 键

linux - Emacs 在 su 到 root 后加载用户配置文件

emacs - 如何在 Emacs 中重新绑定(bind) ctrl ret?

linux - 如何从 emacs 中实际更改/设置环境变量