将 Emacs 窗口拆分为新框架

use*_*983 5 emacs

从包含两个 Emacs 窗口的第一帧,win-one显示缓冲区buf-onewin-two显示buf-two,我希望能够将win-two '打破'到它自己的框架中,也许使用在模型行上按住修改键并单击。在这之后,

  • win-onewin-two 都将保留它们在第一帧中时的各自的高度/宽度和缓冲区关联
  • win-one将保留在相同的第一帧中,而win-two现在将位于新的、单独的第二帧中
  • 尽可能保留原始位置、颜色和字体设置

我想知道这种行为是否在标准库中可用,是否有扩展,或者一个小的 elisp 函数是否可以工作?

Dre*_*rew 1

是的,有这样一个命令:mouse-tear-off-window。我将它绑定到C-mouse-1模式行:

(global-set-key [mode-line C-mouse-1] 'mouse-tear-off-window)
Run Code Online (Sandbox Code Playgroud)

该命令在普通 Emacs ( ) 中可用emacs -Q。但我使用我自己的版本,如果窗口单独位于其框架中,则不会删除该窗口。相反,它克隆框架和窗口。该版本位于库mouse+.el中。文档字符串:

,----
| mouse-tear-off-window is an interactive compiled Lisp function in
| `mouse+.el'.
| 
| It is bound to mode-line C-mouse-1.
| 
| (mouse-tear-off-window EVENT)
| 
| Create a new frame displaying buffer of window clicked on.
| If window is not the only one in frame, then delete it.
| Otherwise, this command effectively clones the frame and window.
`----
Run Code Online (Sandbox Code Playgroud)