5

如何以编程方式在窗口中显示缓冲区other than the current,类似于 Emacs 的 grep 行为next-error。我希望它可以在最新的 Emacs 24.1 中工作。请注意,此逻辑最近在 Emacs 主干中进行了修改,并合并为display-buffer具有相当复杂的调用语义的单个函数。display-buffer即使在阅读了几次帮助之后,我也很难弄清楚它的用途。为什么没有这样的包装函数,例如display-buffer-other-window

4

3 回答 3

5

The lengthy docstring to display-buffer includes the following:

The ACTION argument to `display-buffer' can also have a non-nil and non-list value. This means to display the buffer in a window other than the selected one, even if it is already displayed in the selected window. If called interactively with a prefix argument, ACTION is t.

Therefore to display a specified buffer in a window other than the current, you can use:

(display-buffer BUFFER-OR-NAME t)
于 2012-05-09T11:07:01.340 回答
3

并且包装器存在,顺便说一句,它被称为switch-to-buffer-other-window.

于 2012-05-10T02:12:30.510 回答
3

Emacs 资源给了我答案

(pop-to-buffer BUFFER 'other-window)
于 2012-05-09T10:56:37.480 回答