Function: magit-process-finish-section

magit-process-finish-section is a byte-compiled function defined in magit-process.el.

Signature

(magit-process-finish-section SECTION EXIT-CODE)

Source Code

;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-process.el
(defun magit-process-finish-section (section exit-code)
  (let ((inhibit-read-only t)
        (buffer (current-buffer))
        (marker (oref section start)))
    (goto-char marker)
    (save-excursion
      (delete-char 3)
      (set-marker-insertion-type marker nil)
      (insert (propertize (format "%3s" exit-code)
                          'magit-section section
                          'font-lock-face (if (= exit-code 0)
                                              'magit-process-ok
                                            'magit-process-ng)))
      (set-marker-insertion-type marker t))
    (when (eq magit-process-apply-ansi-colors t)
      (ansi-color-apply-on-region (oref section content)
                                  (oref section end)))
    (cond ((= (oref section end)
              (+ (line-end-position) 2))
           (save-excursion
             (goto-char (1+ (line-end-position)))
             (delete-char -1)
             (oset section content nil)))
          ((and (= exit-code 0)
                (not (seq-some (##eq (window-buffer %) buffer)
                               (window-list))))
           (magit-section-hide section)))))