在 emacs 中使用两个框架时,如何防止编译缓冲区同时出现在两个框架中? [英] When using two frames in emacs, how do I prevent the compilation buffer from showing up in both?

查看:26
本文介绍了在 emacs 中使用两个框架时,如何防止编译缓冲区同时出现在两个框架中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用两台显示器工作,经常使用打开两帧的emacs;每个显示器一个.每个框架被分成两个并排的窗口,如下所示:

I work with two monitors, and often use emacs with two frames open; one for each monitor. each frame is split into two side-by-side windows, like so:

 a | b   <-- frame 1 in monitor 1
-------
 c | d   <-- frame 2 in monitor 2

当我在窗口 a 中点击编译"按钮时,编译缓冲区在它旁边的缓冲区中打开.到目前为止一切顺利:

When I hit my 'compile' button while in window a, the compilation buffer opens in the buffer next to it. So far so good:

 a | compilation
-----------------
 c |     d

然而,如果我然后移动到窗口 c 来编辑一些东西,然后再次点击编译,窗口 d 也会访问编译缓冲区:

However, if I then move to window c to edit some stuff, then hit compile again, window d visits the compilation buffer as well:

 a | compilation
------------------
 c | compilation

所以现在我有一半的屏幕空间被同一个编译缓冲区的两个副本占用,想知道为什么我有两个显示器:)

So now I have half of my screen real-estate taken up by two copies of the same compilation buffer, wondering why I have two monitors :)

当我的光标位于当前打开的编译缓冲区旁边的缓冲区中时,我可以通过认真地只点击编译键来防止这种情况发生,但是我很早地并且经常点击编译"以致我通常没有头脑这样做.我觉得 .emacs 中必须有一些我可以调整的东西,所以我不应该这样做.

I can prevent this by conscientiously only hitting the compile key when my cursor is in the buffer next to the currently open compile buffer, but I hit 'compile' so early and often that I usually don't have the presence of mind to do so. I feel like there must be something I can tweak in .emacs so I shouldn't have to.

有什么建议吗?理想情况下,当我点击编译"时,当前打开的编译缓冲区应该从其前一个窗口移动到当前使用的窗口旁边的窗口.如果这太复杂了,我很容易满足于让 emacs 访问相邻窗口中的编译缓冲区,如果它已经在另一个窗口中打开了.

Any suggestions? Ideally, when I hit 'compile', the currently open compilation buffer should move from its previous window to the one next to the currently used window. If that's too complicated, I'd easily settle for having emacs not visit the compilation buffer in the neighboring window, if it's already open in another window.

推荐答案

(setq-default display-buffer-reuse-frames t)

来自文档:

非零意味着显示缓冲区"应该重用帧.如果有问题的缓冲区已经显示在框架中,则引发那个框架.

Non-nil means `display-buffer' should reuse frames. If the buffer in question is already displayed in a frame, raise that frame.

这篇关于在 emacs 中使用两个框架时,如何防止编译缓冲区同时出现在两个框架中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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