Subject: Re: bug#17675: 24.4.50; *gud* buffer keeps on getting buried

From: martin rudalics <[email-masked]>
Date: Wed, 04 Jun 2014 16:51:05 +0200

> When gud-gdb is started, it uses `switch-to-buffer', which places
 > *gud-foo* in the window previously occupied by foo.c.

Then this is the culprit.  It doesn't make sense to keep the *scratch*
window around when debugging foo.c because sooner or later gdb will have
to display foo.c again.  Instead of `switch-to-buffer' we should use
`display-buffer' here.  Where is this `switch-to-buffer' call issued?

BTW, this is an issue that bothers me as well because usually I want to
immediately set a breakpoint at the current position of `window-point'
in the source buffer.  Hence I start displaying the source file in one
window, split it, and then invoke gdb from the lower window.

 > When gdb gets
 > "start", foo.c replaces *gud-foo* instead of *scratch* because foo.c has
 > been in the window that *gud-foo* occupies, and not in the window that
 > *scratch* occupies.  This is what `display-buffer-in-previous-window'
 > does, no?

Correct.  IIRC I wrote `display-buffer-in-previous-window' because
someone using edebug complained about the source code always being
displayed alternately in one of two windows.  So if you want an
instantaneous solution for this you will have to customize
`display-buffer-alist' to avoid `display-buffer-in-previous-window'.

martin