Function: magit-process-filter
magit-process-filter is a byte-compiled function defined in
magit-process.el.
Signature
(magit-process-filter PROC STRING)
Documentation
Default filter used by magit-start-process.
Source Code
;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-process.el
(defun magit-process-filter (proc string)
"Default filter used by `magit-start-process'."
(with-current-buffer (process-buffer proc)
(let ((inhibit-read-only t))
(goto-char (process-mark proc))
;; Find last ^M in string. If one was found, ignore
;; everything before it and delete the current line.
(when-let ((ret-pos (cl-position ?\r string :from-end t)))
(setq string (substring string (1+ ret-pos)))
(delete-region (line-beginning-position) (point)))
(setq string (magit-process-remove-bogus-errors string))
(when (eq magit-process-apply-ansi-colors 'filter)
(setq string (ansi-color-apply string)))
(insert (propertize string 'magit-section
(process-get proc 'section)))
(set-marker (process-mark proc) (point))
;; Make sure prompts are matched after removing ^M.
(magit-process-yes-or-no-prompt proc string)
(magit-process-username-prompt proc string)
(magit-process-password-prompt proc string)
(run-hook-with-args-until-success 'magit-process-prompt-functions
proc string))))