简体   繁体   English

在emacs下使用gdb时的缓冲控制

[英]Buffer control when using gdb under emacs

I am using gdb under emacs. 我在emacs下使用gdb。 During a debug session, when emacs/gdb jumps to source code i usually open up another frame (Cx 5 2) and pull that onto my second monitor. 在调试会话期间,当emacs / gdb跳转到源代码时,我通常打开另一个帧(Cx 5 2)并将其拉到我的第二个监视器上。 The problem comes when a new source code file needs to be opened (for example when the program enters a function defined in another source file, walking the stack, etc ...) emacs tends to automatically open up the corresponding source code in a new window, but unfortunately in the gdb frame. 当需要打开一个新的源代码文件时(例如当程序进入另一个源文件中定义的函数,遍历堆栈等等)时,问题就来了.emacs倾向于自动打开新的相应源代码窗口,但不幸的是在gdb框架中。

I would like for it pull up new source code in the new frame i opened up and leave the gdb frame completely untouched. 我想在我打开的新框架中拉出新的源代码并完全保持gdb框架不变。 My question then is this: 我的问题是:

How can i set emacs to open up any new file such that the file is displayed in the new frame? 如何设置emacs打开任何新文件,使文件显示在新框架中?

I hope i am making sense. 我希望我有意义。

Not a simple answer, but an appropriate entry in display-buffer-alist could tell display-buffer to always use the frame you want as the destination for new buffers. 这不是一个简单的答案,但display-buffer-alist中的相应条目可以告诉display-buffer始终使用您想要的帧作为新缓冲区的目标。

In 24.1, the doc is: 在24.1中,文档是:

display-buffer-alist is a variable defined in `window.el'. display-buffer-alist是`window.el'中定义的变量。 Its value is nil 它的价值是零

This variable may be risky if used as a file-local variable. 如果用作文件局部变量,则此变量可能存在风险。

Documentation: Alist of conditional actions for `display-buffer'. 文档:“display-buffer”的条件操作的列表。 This is a list of elements (CONDITION . ACTION), where: 这是一个元素列表(CONDITION.ACTION),其中:

CONDITION is either a regexp matching buffer names, or a function that takes two arguments - a buffer name and the ACTION argument of `display-buffer' - and returns a boolean. CONDITION是一个正则表达式匹配缓冲区名称,或者是一个带有两个参数的函数 - 缓冲区名称和`display-buffer'的ACTION参数 - 并返回一个布尔值。

ACTION is a cons cell (FUNCTION . ALIST), where FUNCTION is a ACTION是一个cons单元格(FUNCTION.ALIST),其中FUNCTION是a
function or a list of functions. 功能或功能列表。 Each such function should accept two arguments: a buffer to display and an alist of the same form as ALIST. 每个这样的函数都应该接受两个参数:一个要显示的缓冲区和一个与ALIST相同形式的列表。 See `display-buffer' for details. 有关详细信息,请参阅`display-buffer'。

`display-buffer' scans this alist until it either finds a matching regular expression or the function specified by a condition returns non-nil. `display-buffer'扫描此alist,直到找到匹配的正则表达式或条件指定的函数返回非nil。 In any of these cases, it adds the associated action to the list of actions it will try. 在任何这些情况下,它都会将相关操作添加到它将尝试的操作列表中。

You can customize this variable. 您可以自定义此变量。

This variable was introduced, or its default value was changed, in version 24.1 of Emacs. 在Emacs的版本24.1中引入了此变量,或者更改了其默认值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM