Function: gdb-load-window-configuration
gdb-load-window-configuration is an interactive and byte-compiled
function defined in gdb-mi.el.gz.
Signature
(gdb-load-window-configuration FILE)
Documentation
Restore window configuration (layout) from FILE.
FILE should be a window configuration file saved by
gdb-save-window-configuration.
Probably introduced at or before Emacs version 28.1.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/gdb-mi.el.gz
(defun gdb-load-window-configuration (file)
"Restore window configuration (layout) from FILE.
FILE should be a window configuration file saved by
`gdb-save-window-configuration'."
(interactive (list (read-file-name
"Restore window configuration from file: "
(or gdb-window-configuration-directory
default-directory))))
;; Basically, we restore window configuration and go through each
;; window and restore the function buffers.
(let* ((placeholder (get-buffer-create " *gdb-placeholder*")))
(unwind-protect ; Don't leak buffer.
(let ((window-config (with-temp-buffer
(insert-file-contents file)
;; We need to go to point-min because
;; `read' reads from point
(goto-char (point-min))
(read (current-buffer))))
(source-buffer (or (gdb-get-source-buffer)
;; Do the same thing as in
;; `gdb-setup-windows' if no source
;; buffer is found.
(list-buffers-noselect)))
buffer-type)
(window-state-put window-config (frame-root-window))
(dolist (window (window-list nil 'no-minibuffer))
(with-selected-window window
(setq buffer-type (window-parameter nil 'gdb-buffer-type))
(pcase buffer-type
('source (when source-buffer
(set-window-buffer nil source-buffer)
(push (selected-window) gdb-source-window-list)))
('command (switch-to-buffer gud-comint-buffer))
(_ (let ((buffer (gdb-get-buffer-create buffer-type)))
(with-window-non-dedicated nil
(set-window-buffer nil buffer))))))))
(kill-buffer placeholder))))