Function: projectile-search--gather-rg
projectile-search--gather-rg is a byte-compiled function defined in
projectile.el.
Signature
(projectile-search--gather-rg BUFFER TERM ON-DONE)
Documentation
Scan for literal TERM into BUFFER via rg --json, then call ON-DONE.
When BUFFER carries a projectile-replace--rg-pattern, that
ripgrep-syntax regexp is searched for instead of the literal TERM.
Resets BUFFER's match list and scanning state, then walks
projectile-replace--projects one project at a time, streaming parsed
matches into the buffer as ripgrep emits them and re-rendering per output
chunk.
One rg per project rather than one rg over the group, because the
ignore globs are root-anchored: they only mean what they say when ripgrep
runs inside the project that wrote them. The runs are sequential, so a
single process is live at a time and cancellation stays as simple as it
was for one project.
projectile-search-max-matches is honored across the whole group (the
run stops when the cap is hit) and the scan is cancelable and kill-safe
exactly like the elisp async engine: the live process is registered in
projectile-replace--scan-process so projectile-replace--cancel-scan
(re-search, quit, kill-buffer) can kill it, leaving no orphan. ON-DONE
(or nil) is called in BUFFER when the last project has been scanned.
Source Code
;; Defined in ~/.emacs.d/elpa/projectile-20260820.1509/projectile.el
(defun projectile-search--gather-rg (buffer term on-done)
"Scan for literal TERM into BUFFER via `rg --json', then call ON-DONE.
When BUFFER carries a `projectile-replace--rg-pattern', that
ripgrep-syntax regexp is searched for instead of the literal TERM.
Resets BUFFER's match list and scanning state, then walks
`projectile-replace--projects' one project at a time, streaming parsed
matches into the buffer as ripgrep emits them and re-rendering per output
chunk.
One `rg' per project rather than one `rg' over the group, because the
ignore globs are root-anchored: they only mean what they say when ripgrep
runs inside the project that wrote them. The runs are sequential, so a
single process is live at a time and cancellation stays as simple as it
was for one project.
`projectile-search-max-matches' is honored across the whole group (the
run stops when the cap is hit) and the scan is cancelable and kill-safe
exactly like the elisp async engine: the live process is registered in
`projectile-replace--scan-process' so `projectile-replace--cancel-scan'
\(re-search, quit, kill-buffer) can kill it, leaving no orphan. ON-DONE
\(or nil) is called in BUFFER when the last project has been scanned."
(with-current-buffer buffer
(setq projectile-replace--matches nil
projectile-replace--truncated nil
projectile-replace--filtered nil
projectile-replace--scanning t
projectile-replace--scan-timer nil
projectile-replace--scan-process nil))
(projectile-search--rg-scan-roots
buffer term
(buffer-local-value 'projectile-replace--projects buffer)
(buffer-local-value 'projectile-replace--scan-generation buffer)
on-done))