Function: dired-rsync--filter

dired-rsync--filter is a natively compiled function defined in dired-rsync.el.

Signature

(dired-rsync--filter PROC STRING)

Documentation

PROC rsync process filter, insert STRING into buffer.

This gets called with string whenever there is new data to display in the process buffer. We scan the string to extract useful information and update the dired-rsync-modeline-status.

Source Code

;; Defined in /nix/store/i42d1fmg6q3dci37c05j415vhqjrzi15-emacs-packages-deps/share/emacs/site-lisp/elpa/dired-rsync-20261005.758/dired-rsync.el
(defun dired-rsync--filter (proc string)
  "`PROC' rsync process filter, insert `STRING' into buffer.

This gets called with string whenever there is new data to
display in the process buffer.  We scan the string to extract useful
information and update the dired-rsync-modeline-status."

  ;; scan the new string
  (let ((err nil) (indicator nil))
    ;; Grab % complete string
    (when (string-match dired-rsync-percent-complete-regex string)
      (setq indicator (match-string 0 string)))
    ;; check for prompt
    (when (string-match dired-rsync-passphrase-stall-regex string)
      (process-send-string proc (concat (read-passwd string) "\n")))
    ;; update if anything to report
    (when (or err indicator)
      (dired-rsync--update-modeline err indicator)))

  ;; update the process buffer (we could just drop?)
  (let ((old-process-mark (process-mark proc)))
    ;; do the normal buffer text insertion
    (when (buffer-live-p (process-buffer proc))
      (with-current-buffer (process-buffer proc)
        (let ((moving (= (point) old-process-mark)))
          (save-excursion
            ;; Insert the text, advancing the process marker.
            (goto-char old-process-mark)
            (insert string)
            (set-marker (process-mark proc) (point))
            ;; Delete old text upto the newline
            (goto-char (point-max))
            (when (search-backward "\r" nil t)
              (delete-region (point-min) (+ 1 (match-beginning 0)))))
          (if moving
              (goto-char (process-mark proc))))))))