I forgot to apply the new trick I learned to gdb-store-window-configuration. The trick makes file writing cleaner. This is the store-window patch with that trick applied Now the following code is used instead of find-file and insert. (with-temp-buffer (prin1 window-config (current-buffer)) (write-file file t)) Yuan On Thu, Jan 16, 2020 at 7:38 PM Yuan Fu wrote: > Here is an updated patch for store-window feature. I fixed some problem of > the last one and added some new features. With this patch, you can > > 1. store your window configuration to a file, and load it back in a gdb > session, and > 2. set a default window config file to be loaded on gdb startup. > 3. Now gdb preserves the window configuration you had before starting gdb > > More about 3.: currently when gdb quits, it leaves you with two windows, > one in gdb comint buffer and one in source buffer, regardless of what you > had before staring gdb. The third commit in the patch makes gdb restore the > old window configuration you had before staring gdb. > > I also attached my window configuration file as default-rearrange. > > Yuan > > > On Thu, Jan 16, 2020 at 10:04 AM Yuan Fu wrote: > >> >> > I'm back working on gdb. This time I fixed a issue where gdb opens more >>> than one window to display source >>> > code. By the design of gdb-mi, it should only have one source window. >>> >>> Thanks, can you show a use case where such a problem happens? >>> >> >> Yes, basically any program with more than one source file and a large >> screen (display-buffer will reuse window if there aren't enough space). >> >> A minimal setup: >> >> a.c: >> >> int f1(int a) { >> return a + 1; >> } >> >> b.c: >> >> #include "a.c" >> >> int main() { >> int b = f1(1); >> int c = 0; >> return b + c; >> } >> >> Steps: >> - M-x gdb >> - b main >> - r >> - s (many times) >> >> And when you step into f1 which is in a.c, gdb opens another window to >> display it (again, if your screen is large enough). >> >> BTW, I say "by design gdb uses a single source window" because >> gdb-display-source-window is written that way. >> >> Yuan >> >