From c75dd5f5ad5bddc323e57844dcdd45239734aa8a Mon Sep 17 00:00:00 2001
From: Yuan Fu <casouri@gmail.com>
Date: Sun, 15 Mar 2020 21:02:14 -0400
Subject: [PATCH] Add documentation for previous commit by Yuan Fu

* etc/NEWS: Add news entry.
* doc/emacs/building.texi (GDB User Interface Layout): Add
documentation for 'gdb-save-window-configuration',
'gdb-load-window-configuration',
'gdb-default-window-configuration-file',
'gdb-window-configuration-directory',
'gdb-restore-window-configuration-after-quit'.  Change 'many-windows
layout' to 'default layout'
---
 doc/emacs/building.texi | 30 ++++++++++++++++++++++++++++--
 etc/NEWS                | 16 ++++++++++++++++
 2 files changed, 44 insertions(+), 2 deletions(-)

diff --git a/doc/emacs/building.texi b/doc/emacs/building.texi
index 38963f225c..11bc239012 100644
--- a/doc/emacs/building.texi
+++ b/doc/emacs/building.texi
@@ -975,9 +975,29 @@ GDB User Interface Layout
 @end group
 @end smallexample
 
+@findex gdb-save-window-configuration
+@findex gdb-load-window-configuration
+@vindex gdb-default-window-configuration-file
+@vindex gdb-window-configuration-directory
+  You can customize the window layout based on the one above, and save
+the custom layout to a file using
+@code{gdb-save-window-configuration}.  Then you can later load this
+layout back using @code{gdb-load-window-configuration}.  (Simply put,
+window configuration is the Emacs jargon for window layout.)  You can
+set your custom layout file as the default one used by
+@code{gdb-many-windows} by customizing
+@code{gdb-default-window-configuration-file}.  If it is not an
+absolute path, GDB looks under
+@code{gdb-window-configuration-directory} for the file.
+@code{gdb-window-configuration-directory} defaults to
+@code{user-emacs-directory} (@pxref{How Emacs Finds Your Init File,,,
+custom.texi, Customization}).
+
+
 @findex gdb-restore-windows
 @findex gdb-many-windows
-  If you ever change the window layout, you can restore the many-windows
+@vindex gdb-restore-window-configuration-after-quit
+  If you ever change the window layout, you can restore the default
 layout by typing @kbd{M-x gdb-restore-windows}.  To toggle
 between the many windows layout and a simple layout with just the GUD
 interaction buffer and a source file, type @kbd{M-x gdb-many-windows}.
@@ -988,7 +1008,13 @@ GDB User Interface Layout
 of windows on your original frame will not be affected.  A separate
 frame for GDB sessions can come in especially handy if you work on a
 text-mode terminal, where the screen estate for windows could be at a
-premium.
+premium.  If you choose to start GDB in the same frame, consider
+setting @code{gdb-restore-window-configuration-after-quit} to a
+non-@code{nil} value.  Your original layout will then be restored
+after GDB quits.  Use @code{t} to always restore; use
+@code{if-gdb-many-windows} to restore only when
+@code{gdb-many-windows} is non-@code{nil}; use @code{if-gdb-show-main}
+to restore only when @code{gdb-show-main} is non-@code{nil}.
 
   You may also specify additional GDB-related buffers to display,
 either in the same frame or a different one.  Select the buffers you
diff --git a/etc/NEWS b/etc/NEWS
index 87e634f2c1..f61bff6a4f 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -174,6 +174,22 @@ key             binding
 / v             package-menu-filter-by-version
 / /             package-menu-filter-clear
 
+** gdb-mi
+
+*** gdb-mi can now store and restore window configurations.
+Use 'gdb-save-window-configuration' to save window configuration to a
+file, and 'gdb-load-window-configuration' to load from a file.  These
+commands can also be accessed through menu bar under Gud --
+GDB-Windows.  'gdb-default-window-configuration-file', when non-nil,
+is loaded when GDB starts up.
+
+*** gdb-mi can now restore window configuration after quit.
+Set 'gdb-restore-window-configuration-after-quit' to non-nil and Emacs
+will remember the window configuration before GDB started, and restore
+it after GDB quits.  Toggle button is also provided under Gud --
+GDB-Windows.
+
+
 
 * New Modes and Packages in Emacs 28.1
 
-- 
2.25.1

