Emacs 保存和恢复屏幕选项卡和拆分框架

Emacs 保存和恢复屏幕选项卡和拆分框架,emacs,Emacs,我有许多水平和垂直分割的elscreen选项卡(框架?)。我希望能够保存当前缓冲区、每个帧中的窗口布局以及帧本身 简而言之,我希望能够关闭emacs并以与关闭它时相对相同的状态重新打开它 (我想我的术语是对的)以下是我在.emacs中的内容,正是为了这个目的(内联的源代码): 自动保存和恢复屏幕会话 ;; http://stackoverflow.com/questions/803812/emacs-reopen-buffers-from-last-session-on-startup (def

我有许多水平和垂直分割的elscreen选项卡(框架?)。我希望能够保存当前缓冲区、每个帧中的窗口布局以及帧本身

简而言之,我希望能够关闭emacs并以与关闭它时相对相同的状态重新打开它


(我想我的术语是对的)

以下是我在.emacs中的内容,正是为了这个目的(内联的源代码):

自动保存和恢复屏幕会话

;; http://stackoverflow.com/questions/803812/emacs-reopen-buffers-from-last-session-on-startup
(defvar emacs-configuration-directory
    "~/.emacs.d/"
    "The directory where the emacs configuration files are stored.")
(defvar elscreen-tab-configuration-store-filename
    (concat emacs-configuration-directory ".elscreen")
    "The file where the elscreen tab configuration is stored.")
退出时自动保存屏幕:

(defun elscreen-store ()
    "Store the elscreen tab configuration."
    (interactive)
    (if (desktop-save emacs-configuration-directory)
        (with-temp-file elscreen-tab-configuration-store-filename
            (insert (prin1-to-string (elscreen-get-screen-to-name-alist))))))

;; (push #'elscreen-store kill-emacs-hook)
(defun elscreen-restore ()
    "Restore the elscreen tab configuration."
    (interactive)
    (if (desktop-read)
        (let ((screens (reverse
                        (read
                         (with-temp-buffer
                          (insert-file-contents elscreen-tab-configuration-store-filename)
                          (buffer-string))))))
            (while screens
                (setq screen (car (car screens)))
                (setq buffers (split-string (cdr (car screens)) ":"))
                (if (eq screen 0)
                    (switch-to-buffer (car buffers))
                    (elscreen-find-and-goto-by-buffer (car buffers) t t))
                (while (cdr buffers)
                    (switch-to-buffer-other-window (car (cdr buffers)))
                    (setq buffers (cdr buffers)))
                (setq screens (cdr screens))))))



;; (elscreen-restore)
启动时自动恢复屏幕:

(defun elscreen-store ()
    "Store the elscreen tab configuration."
    (interactive)
    (if (desktop-save emacs-configuration-directory)
        (with-temp-file elscreen-tab-configuration-store-filename
            (insert (prin1-to-string (elscreen-get-screen-to-name-alist))))))

;; (push #'elscreen-store kill-emacs-hook)
(defun elscreen-restore ()
    "Restore the elscreen tab configuration."
    (interactive)
    (if (desktop-read)
        (let ((screens (reverse
                        (read
                         (with-temp-buffer
                          (insert-file-contents elscreen-tab-configuration-store-filename)
                          (buffer-string))))))
            (while screens
                (setq screen (car (car screens)))
                (setq buffers (split-string (cdr (car screens)) ":"))
                (if (eq screen 0)
                    (switch-to-buffer (car buffers))
                    (elscreen-find-and-goto-by-buffer (car buffers) t t))
                (while (cdr buffers)
                    (switch-to-buffer-other-window (car (cdr buffers)))
                    (setq buffers (cdr buffers)))
                (setq screens (cdr screens))))))



;; (elscreen-restore)

您是否尝试过使用Emacs的snapshot developer版本和内置的
desktop.el
来查看它离您想要的位置有多近?我会从那开始,然后在必要时调整屏幕。您的水平/垂直拆分称为
windows
框架
包含所有的
窗口
,可以最小化或最大化。我的理解是,Emacs的开发人员版本有一些额外的小发明,用于恢复
windows
,这在稳定的公共版本中尚不可用。