Function: projectile-ag

projectile-ag is an autoloaded, interactive and byte-compiled function defined in projectile.el.

Signature

(projectile-ag SEARCH-TERM &optional ARG)

Documentation

Run an ag search with SEARCH-TERM in the project.

With an optional prefix argument ARG SEARCH-TERM is interpreted as a regular expression.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/projectile-20260310.858/projectile.el
;;;###autoload
(defun projectile-ag (search-term &optional arg)
  "Run an ag search with SEARCH-TERM in the project.

With an optional prefix argument ARG SEARCH-TERM is interpreted as a
regular expression."
  (interactive
   (list (projectile--read-search-string-with-default
          (format "Ag %ssearch for" (if current-prefix-arg "regexp " "")))
         current-prefix-arg))
  (if (require 'ag nil 'noerror)
      (let ((ag-command (if arg 'ag-regexp 'ag))
            (ag-ignore-list (delq nil
                                  (seq-uniq
                                   (append
                                    ag-ignore-list
                                    (projectile-ignored-files-rel)
                                    (projectile-ignored-directories-rel)
                                    (projectile--globally-ignored-file-suffixes-glob)
                                    ;; ag supports git ignore files directly
                                    (unless (eq (projectile-project-vcs) 'git)
                                      (append grep-find-ignored-files
                                              grep-find-ignored-directories
                                              '()))))))
            ;; reset the prefix arg, otherwise it will affect the ag-command
            (current-prefix-arg nil))
        (funcall ag-command search-term (projectile-acquire-root)))
    (error "Package 'ag' is not available")))