66您可以在ediff的进入/退出钩子上设置功能以保存/恢复窗口配置,并创建一个新框架。在Emacs 24.3中,这似乎很有效 - 我不明白为什么它不能在旧版本中工作:
(defvar pre-ediff-window-configuration nil
"window configuration to use")
(defvar new-ediff-frame-to-use nil
"new frame for ediff to use")
(defun save-my-window-configuration ()
(interactive)
(setq pre-ediff-window-configuration (current-window-configuration))
(select-frame-set-input-focus (setq new-ediff-frame-to-use (new-frame))))
(add-hook 'ediff-before-setup-hook 'save-my-window-configuration)
(defun restore-my-window-configuration ()
(interactive)
(when (framep new-ediff-frame-to-use)
(delete-frame new-ediff-frame-to-use)
(setq new-ediff-frame-to-use nil))
(when (window-configuration-p pre-ediff-window-configuration)
(set-window-configuration pre-ediff-window-configuration)))
(add-hook 'ediff-after-quit-hook-internal 'restore-my-window-configuration)
- Trey Jackson1很棒的解决方案。小问题:我认为倒数第二行(set-window-configuration pre-ediff-window-configuration)))需要一个额外的闭合括号。 - daveraja回答链接55关于这个问题(虽然你问的是如何恢复窗口配置而不是框架配置):
最近Emacs 24版本的开发快照可以让你持久保存和恢复当前框架集。请参阅新库frameset.el和更新的库desktop.el。需要注意的是,这还在不断地开发中,可能会有所改变。
- Drew回答链接44至少在emacs版本大于等于25时,您可以使用C-x r f
当我使用emacsclient连接到长期运行的emacs守护进程时,这非常有帮助。存储的框架布局可以在守护进程的生存期内存在。
您也可以使用C-x r w
- ShellayLee回答链接33请看Emacs手册关于寄存器的章节。你可以将窗口配置保存到一个寄存器中,运行ediff,然后恢复配置。默认绑定为C-x r w R用于'写入'寄存器,C-x r j R用于'跳转'到寄存器。如果您经常使用此功能,则可以相应地重新绑定它们。
您还可以编写自己的函数,创建一个新窗口并运行ediff。这需要进行一些调整,因为ediff从迷你缓冲区读取文件名,但应该很容易。
- seanmcl回答链接