开发者

Open 'undo-tree-visualize side by side to the buffer, and not "vertically"

Is the开发者_如何学运维re any way I can make undo-tree-mode display the visualization in a "horizontal" buffer (ie. C-x 3 vs. C-x 2)?

Open 'undo-tree-visualize side by side to the buffer, and not "vertically"


As per @Tom's suggestion, I whipped up a solution that applies only to 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 is now deprecated in favour of advice-add. The updated version of the solution above would be the following:

(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)


The undo-tree package uses standard Emacs buffer display functions to show the tree window (as opposed to a specific function). To control how Emacs splits windows, you can customize the variables split-window-preferred-function, split-height-threshold, and split-width-threshold. Also check out the documentation for the function split-window-sensibly.

If you are OK with Emacs in general preferring side-by-side windows over top-and-bottom ones, put this code in your init file:

(setq split-height-threshold 0)

(If you want side-by-side windows only for undo-tree-visualize, the story is a little more complicated.)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜