【问题标题】:next-buffer skipping buffers when window is split in emacs在 emacs 中拆分窗口时下一个缓冲区跳过缓冲区
【发布时间】:2013-01-25 14:47:58
【问题描述】:

我是 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。 “下一个缓冲区”仅在 PaneRight 中的 A 和 B 中循环。它跳过 C 可能是因为 C 在 PaneLeft 中已经可见。

切换回 PaneLeft,并确保 A 或 B 聚焦在 PaneLeft。

切换回 PaneRight,现在“下一个缓冲区”在 A、B 和 C 之间循环,无论 PaneLeft 中可见什么。

这是预期的行为吗?我怎样才能让它按我的预期工作?

注意:我在没有任何自定义扩展的情况下运行,我的 .emacs 几乎是空的。

【问题讨论】:

  • 我无法在 Windows XP 上的 emacs24 中重现这一点。我循环浏览两个窗口中的所有缓冲区。
  • next-buffer 避免显示在其他窗口中已经可见的缓冲区,这是预期的行为(不知道是否有一些没有此属性的 next-buffer 的交互式替换)
  • 感谢您的提示,经过更多调查,我编辑了问题以反映我的发现。 next-buffer 似乎确实可以显示在另一个窗口中可见的缓冲区,但最初不是。

标签: emacs emacs24


【解决方案1】:

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.

如果这不能正常工作,则可能存在错误。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多