Function: projectile-search--rg-ingest

projectile-search--rg-ingest is a byte-compiled function defined in projectile.el.

Signature

(projectile-search--rg-ingest BUFFER LINES ROOT)

Documentation

Parse rg NDJSON LINES into BUFFER's match list, render, honor the cap.

Appends up to projectile-search-max-matches matches in arrival order; when the cap is reached the surplus is dropped and the truncated flag is set. Returns non-nil when the cap has been reached, so the caller can finish the scan.

Source Code

;; Defined in ~/.emacs.d/elpa/projectile-20260820.1509/projectile.el
(defun projectile-search--rg-ingest (buffer lines root)
  "Parse rg NDJSON LINES into BUFFER's match list, render, honor the cap.
Appends up to `projectile-search-max-matches' matches in arrival order;
when the cap is reached the surplus is dropped and the truncated flag is
set.  Returns non-nil when the cap has been reached, so the caller can
finish the scan."
  (with-current-buffer buffer
    (if projectile-replace--truncated
        t
      (let ((new nil))
        (dolist (l lines)
          (unless (string-empty-p l)
            (setq new (nconc new (projectile-search--rg-parse-line l root)))))
        (let ((room (- projectile-search-max-matches
                       (length projectile-replace--matches))))
          (when (> (length new) room)
            (setq new (take (max 0 room) new)
                  projectile-replace--truncated t))
          (when new
            (setq projectile-replace--matches
                  (append projectile-replace--matches new)))
          (projectile-replace--render-progress)
          projectile-replace--truncated)))))