并排打开“撤消树可视化”到缓冲区,而不是“垂直”打开

发布于 2024-12-01 14:49:46 字数 225 浏览 2 评论 0原文

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

我想要什么](![在此处输入图像描述

Is there any way I can make undo-tree-mode display the visualization in a "horizontal" buffer (ie. C-x 3 vs. C-x 2)?

What I want](![enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

哥,最终变帅啦 2024-12-08 14:49:46

根据@Tom的 建议,我提出了一个仅适用于撤消树的解决方案:

(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-29defadvice 现已弃用,取而代之的是 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)

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)
§对你不离不弃 2024-12-08 14:49:46

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

如果您对 Emacs 通常更喜欢并排窗口而不是上下窗口,请将此代码放入您的 init 文件中:(

(setq split-height-threshold 0)

如果您只希望并排窗口用于 undo-tree-可视化,这个故事有点复杂。)

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文