打开'撤消树 - 并排显示缓冲区,而不是“垂直”

时间:2011-08-29 00:39:52

标签: plugins emacs undo-redo

有什么方法可以让undo-tree-mode在“水平”缓冲区中显示可视化(即C-x 3与C-x 2)?

What I want](![enter image description here

2 个答案:

答案 0 :(得分:5)

根据@ Tom的suggestion,我提出了一个仅适用于undo-tree的解决方案:

(defadvice undo-tree-visualize (around undo-tree-split-side-by-side activate)
  "Split undo-tree side-by-side"
  (let ((split-height-threshold nil)
        (split-width-threshold 0))
  ad-do-it))

2017-04-29 defadvice现已弃用,取而代之的是advice-add。上述解决方案的更新版本如下:

(defun undo-tree-split-side-by-side (original-function &rest args)
  "Split undo-tree side-by-side"
  (let ((split-height-threshold nil)
        (split-width-threshold 0))
    (apply original-function args)))

(advice-add 'undo-tree-visualize :around #'undo-tree-split-side-by-side)

答案 1 :(得分:1)

undo-tree包使用标准的Emacs缓冲区显示功能来显示树窗口(而不是特定的功能)。要控制Emacs如何拆分窗口,您可以自定义变量split-window-preferred-functionsplit-height-thresholdsplit-width-threshold。另请查看函数split-window-sensibly的文档。

如果您对Emacs通常更喜欢并排窗口而不是顶层窗口,请将此代码放在init文件中:

(setq split-height-threshold 0)

(如果你只想要undo-tree-visualize的并排窗口,那么这个故事会更复杂一些。)