Emacs - 打开缓冲区列表而不替换另一个缓冲区 [英] Emacs - Open buffer list without replacing another buffer

查看:222
本文介绍了Emacs - 打开缓冲区列表而不替换另一个缓冲区的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个框架,一个窗口。
我使用Cx 3,现在有两个窗口。



我使用Cx Cb来查看缓冲区列表,但是在另一个窗口中打开它但不重点放在它上面。如果我在第二个窗口打开一个缓冲区,那就更麻烦了。



我宁愿打开目前有焦点的窗口中的缓冲区列表,或者暂时将焦点更改为缓冲区列表。

解决方案

首先,我想先说说 ibuffer 函数与你想要的一样,在当前窗口中这样做,它绝对值得一试。



现在你的实际问题。 C-x C-b 默认情况下调用函数 list-buffers 。如果您使用 Ch f 搜索该命令,它将显示文档,您可以从中查看该功能的源代码,方法是点击下划线的文本 buff-menu.el



现在我们可以查看 list-buffers ,第一个调用的函数是 display-buffer 。这听起来很有希望。我们现在可以再次使用 C-h f 来搜索 display-buffer 命令。阅读本文档,我们看到变量 display-buffer-alist 决定了 display-buffer ,反过来如何 list-buffers 的作品。然后我们可以通过将(* Buffer List *。display-buffer-same-window)添加到 display-buffer-alist 你会得到所需的结果。



总而言之,你只需要放入(add-to-list'您的init文件中的缓冲区alist'(*缓冲区列表*。display-buffer-same-window)),以进行更改。


I have one frame, one window. I use Cx 3, I now have two windows.

I use Cx Cb in order to see the list of buffers, however it opens it in another window but doesn't put the focus on it. It is even more annoying if I had opened a buffer on the 2nd window.

I would prefer to either open the buffer list in the window which currently has the focus, or temporarily change the focus to the buffer list.

解决方案

First of all I want to start by saying that the ibuffer function does similary to what you want and does so in the current window, its definitely worth checking out.

Now onto your actual question. C-x C-b by default calls the function list-buffers. If you search for that command using C-h f it will show you the documentation, from there you can view the source code for the function by clicking on the underlined text that says buff-menu.el.

Now we can view the source of the list-buffers, the first function called is display-buffer. That sounds promising. We can now use C-h f once again to search for the display-buffer command. Reading though this documentation we see that the variable display-buffer-alist dictates how the display-buffer and in turn how list-buffers works. We can then see that by adding ("*Buffer List*" . display-buffer-same-window) to display-buffer-alist you will get the desired result.

All in all you simply need to put (add-to-list 'display-buffer-alist '("*Buffer List*" . display-buffer-same-window)) in your init file for your changes to take place.

这篇关于Emacs - 打开缓冲区列表而不替换另一个缓冲区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆