gpt4 book ai didi

emacs - 检测 Emacs 窗口已拆分

转载 作者:行者123 更新时间:2023-12-04 11:41:52 27 4
gpt4 key购买 nike

如何检测 Emacs 窗口已被拆分?

在我的 .emacs文件,我有:

(when (display-graphic-p)
(set-frame-size (selected-frame) 166 85)
(split-window-horizontally))

这使我可以并排使用两个缓冲区,每个缓冲区的宽度正好是 80 个字符。

每隔一段时间我就会更改我的 .emacs 文件并想重新加载它,所以我运行 M-x load-file在我的 .emacs 文件和我所在的窗口被重新拆分。

是否有某种命令我可以调用来检查框架是否已经被拆分并且只调用 (split-window-horizontally)如果没有?就像是:
(when (window-is-root)
(split-window-horizontally))

或者
(when (not (window-is-already-split))
(split-window-horizontally))

最佳答案

window-list将返回一个窗口列表(对于当前帧),因此您应该能够执行以下操作:

(when (= (length (window-list)) 1)
(split-window-horizontally))

查看 relevant documentation for windows .

关于emacs - 检测 Emacs 窗口已拆分,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11021847/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com