我是一名 Emacs 新用户,正在学习如何垂直分割窗口并循环每个窗格中的缓冲区。
但是,在一个窗格中打开新文件后,next-buffer 不会在另一个窗格中循环遍历该文件,而是仅在该文件在新窗格中出现一次后才循环。这可以复制如下:
在新的 emacs 会话中打开 2 个文件 A 和 B。
使用“split-window-right”垂直分割窗口。
“next-buffer”在 PaneLeft 和 PaneRight 中循环遍历 A 和 B。
在 PaneLeft 中打开文件 C。
“next-buffer”在 PaneLeft 中循环 A、B、C。
确保 C 聚焦在 PaneLeft,然后切换到 PaneRight。“next-buffer”仅循环访问 PaneRight 中的 A 和 B。它跳过 C 可能是因为 C 已经在 PaneLeft 中可见。
切换回 PaneLeft,并确保 A 或 B 聚焦在 PaneLeft 中。
切换回 PaneRight,现在“下一个缓冲区”会循环通过 A、B 和 C,而不管 PaneLeft 中可见的内容。
这是预期的行为吗?我怎样才能让它按我的预期工作?
注意:我运行时没有任何自定义扩展,并且我的 .emacs 几乎是空的。
有switch-to-visible-buffer变量来控制这种行为。来自 GNU Emacs 24.2 的文档:
switch-to-visible-buffer is a variable defined in `window.el'.
Its value is t
Documentation:
If non-nil, allow switching to an already visible buffer.
If this variable is non-nil, `switch-to-prev-buffer' and
`switch-to-next-buffer' may switch to an already visible buffer
provided the buffer was shown in the argument window before. If
this variable is nil, `switch-to-prev-buffer' and
`switch-to-next-buffer' always try to avoid switching to a buffer
that is already visible in another window on the same frame.
You can customize this variable.
This variable was introduced, or its default value was changed, in
version 24.1 of Emacs.
Run Code Online (Sandbox Code Playgroud)
如果这不能按预期工作,则可能存在错误。