Function: project-find-regexp
project-find-regexp is an autoloaded, interactive and byte-compiled
function defined in project.el.gz.
Signature
(project-find-regexp REGEXP)
Documentation
Find all matches for REGEXP in the current project's roots.
With C-u (universal-argument) prefix, you can specify the directory
to search in, and the file name pattern to search for. The
pattern may use abbreviations defined in grep-files-aliases,
e.g. entering ch is equivalent to *.[ch]. As whitespace
triggers completion when entering a pattern, including it
requires quoting, e.g. C-q (quoted-insert)<space>.
Probably introduced at or before Emacs version 25.1.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/project.el.gz
;;;###autoload
(defun project-find-regexp (regexp)
"Find all matches for REGEXP in the current project's roots.
With \\[universal-argument] prefix, you can specify the directory
to search in, and the file name pattern to search for. The
pattern may use abbreviations defined in `grep-files-aliases',
e.g. entering `ch' is equivalent to `*.[ch]'. As whitespace
triggers completion when entering a pattern, including it
requires quoting, e.g. `\\[quoted-insert]<space>'."
(interactive (list (project--read-regexp)))
(require 'xref)
(require 'grep)
(let* ((caller-dir default-directory)
(pr (project-current t))
(default-directory (project-root pr))
(project-files-relative-names t)
(files
(if (not current-prefix-arg)
(project-files pr)
(let* ((dir (read-directory-name "Base directory: "
caller-dir nil t)))
(setq default-directory (file-name-as-directory dir))
(project--files-in-directory dir
nil
(grep-read-files regexp))))))
(xref-show-xrefs
(apply-partially #'project--find-regexp-in-files regexp files)
nil)))