5
votes

I am using gdb under emacs. During a debug session, when emacs/gdb jumps to source code i usually open up another frame (C-x 5 2) and pull that onto my second monitor. 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.

I would like for it pull up new source code in the new frame i opened up and leave the gdb frame completely untouched. 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?

I hope i am making sense.

1

1 Answers

0
votes

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.

In 24.1, the doc is:

display-buffer-alist is a variable defined in `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'. This is a list of elements (CONDITION . ACTION), where:

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.

ACTION is a cons cell (FUNCTION . ALIST), where FUNCTION is 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. See `display-buffer' for details.

`display-buffer' scans this alist until it either finds a matching regular expression or the function specified by a condition returns non-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.