Function: magit-mode-quit-window

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

Signature

(magit-mode-quit-window KILL-BUFFER)

Documentation

Quit the selected window and bury its buffer.

This behaves similar to quit-window, but when the window was originally created to display a Magit buffer and the current buffer is the last remaining Magit buffer that was ever displayed in the selected window, then delete that window.

Source Code

;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-mode.el
(defun magit-mode-quit-window (kill-buffer)
  "Quit the selected window and bury its buffer.

This behaves similar to `quit-window', but when the window
was originally created to display a Magit buffer and the
current buffer is the last remaining Magit buffer that was
ever displayed in the selected window, then delete that
window."
  (if (or (one-window-p)
          (seq-find (pcase-lambda (`(,buffer))
                      (and (not (eq buffer (current-buffer)))
                           (buffer-live-p buffer)
                           (or (not (window-parameter nil 'magit-dedicated))
                               (with-current-buffer buffer
                                 (derived-mode-p 'magit-mode
                                                 'magit-process-mode)))))
                    (window-prev-buffers)))
      (quit-window kill-buffer)
    (let ((window (selected-window)))
      (quit-window kill-buffer)
      (when (window-live-p window)
        (delete-window window)))))