继续问下关于emacs窗口的逻辑疑惑

打开新的窗口时会覆盖现有的窗口布局. 如: 我打开了三个窗口,一大两小.然后用全局热键呼出 org-agenda 就会变成两个窗口,并且大小固定的平分了框架.

有什么办法可以避免上述情况的发生吗? 比如我希望它能在当前窗口中弹出,并且不影响现有的布局,该是多大是多大.

我都是用winner-undo去恢复被搞乱的窗口。

坐等一个回答,我也抄抄。

这是因为 org-agenda 对于窗口特殊处理的缘故,详见 org-agenda-window-setup,不过把 org-agenda-restore-windows-after-quit 设置为 t,关掉应该就恢复了?

org-agenda-window-setup is a variable defined in org-agenda.el.

Value
reorganize-frame

Set Customize

Documentation
How the agenda buffer should be displayed.

Possible values for this option are:

current-window    Show agenda in the current window, keeping all other windows.
other-window      Use switch-to-buffer-other-window to display agenda.
only-window       Show agenda, deleting all other windows.
reorganize-frame  Show only two windows on the current frame, the current
                  window and the agenda.
other-frame       Use switch-to-buffer-other-frame to display agenda.
                  Also, when exiting the agenda, kill that frame.
other-tab         Use switch-to-buffer-other-tab to display the
                  agenda, making use of the tab-bar-mode introduced
                  in Emacs version 27.1.  Also, kill that tab when
                  exiting the agenda view.

See also the variable org-agenda-restore-windows-after-quit.

This variable was added, or its default value changed, in Org version
9.4.
1 个赞

Emacs 29 默认是 nil,设置 (setq org-agenda-restore-windows-after-quit t) 应该就是楼主想要的,也是我想要的 :smile: 多谢分享。

不知道有什么用途是希望 agenda 退出后改变窗口布局?

打扰了,我就是看了下值是 t :rofl:,以为默认就是 t,没注意可能当初抄 Spacemacs 的时候设置了

非常感谢,正是我要的解决方案

我稍作对比之后,是选择把 org-agenda-window-setup 值设成 current-window.这样更符合我个人的直觉, 即不会弹出新窗口,也不会破坏窗口布局.

这取决于个人的使用环境了,喜欢全屏的用户可能更偏向 agenda 全屏显示。当前窗口显示的话,如果当前窗口太小就会比较尴尬了。这也跟是在大屏幕使用,还是在小屏幕使用有关。选择合适自己的 :smile:

我的使用习惯是,magit-status, ibuffer,agenda 这些都是全屏显示的。用完恢复到原来的状态。

1 个赞