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

 乱七八糟的孤岛_217 发布于 2023-01-01 14:31

我通常有3-4个不同的项目,我一次工作.因此,我试图弄清楚如何从我打开emacs的文件夹中获取emacs加载桌面,并在退出该emacs实例时保存到该文件.

我见过的所有文档都描述了如何让emacs自动打开并从默认位置保存(这使得多个桌面无法实现),或者手动加载桌面并将其保存到特定目录(我现在正在做).

谢谢!

1 个回答
  • 把它放到你的.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))))))
    

    2023-01-01 14:33 回答
撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有