Function: magit-restore-window-configuration

magit-restore-window-configuration is a byte-compiled function defined in magit-mode.el.

Signature

(magit-restore-window-configuration &optional KILL-BUFFER)

Documentation

Bury or kill the current buffer and restore previous window configuration.

Source Code

;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-mode.el
(defun magit-restore-window-configuration (&optional kill-buffer)
  "Bury or kill the current buffer and restore previous window configuration."
  (let ((winconf magit-previous-window-configuration)
        (buffer (current-buffer))
        (frame (selected-frame)))
    (quit-window kill-buffer (selected-window))
    (when (and winconf (equal frame (window-configuration-frame winconf)))
      (set-window-configuration winconf)
      (when (buffer-live-p buffer)
        (with-current-buffer buffer
          (setq magit-previous-window-configuration nil)))
      (set-buffer (with-selected-window (selected-window)
                    (current-buffer))))))