Function: projectile--ripgrep

projectile--ripgrep is a byte-compiled function defined in projectile.el.

Signature

(projectile--ripgrep SEARCH-TERM &optional REGEXP)

Documentation

Run a ripgrep (rg) search for SEARCH-TERM in the project.

When REGEXP is non-nil, SEARCH-TERM is treated as a regular expression. Requires the ripgrep or rg Emacs package.

Source Code

;; Defined in ~/.emacs.d/elpa/projectile-20260930.434/projectile.el
(defun projectile--ripgrep (search-term &optional regexp)
  "Run a ripgrep (rg) search for SEARCH-TERM in the project.
When REGEXP is non-nil, SEARCH-TERM is treated as a regular expression.
Requires the `ripgrep' or `rg' Emacs package."
  ;; we rely on the external packages ripgrep and rg for the actual search
  (cond ((require 'ripgrep nil 'noerror)
         ;; `ripgrep' runs its command line through the shell, so quote
         (let ((args (projectile--ripgrep-ignore-globs t)))
           (ripgrep-regexp search-term
                           (projectile-acquire-root)
                           (if regexp
                               args
                             (cons "--fixed-strings --hidden" args)))))
        ((require 'rg nil 'noerror)
         (rg-run search-term
                 "*"                       ;; all files
                 (projectile-acquire-root)
                 (not regexp)              ;; literal search?
                 nil                       ;; no need to confirm
                 ;; `rg' quotes these itself
                 (projectile--ripgrep-ignore-globs)))
        (t (user-error "Packages `ripgrep' and `rg' are not available"))))