Function: projectile--search-ext-argument
projectile--search-ext-argument is a byte-compiled function defined in
projectile.el.
Signature
(projectile--search-ext-argument DESC FILE-EXT)
Documentation
Return FILE-EXT as one shell-quoted argument for the tool described by DESC.
DESC is an entry of projectile--search-tool-descriptors. The glob is
turned into a regexp and anchored first when the tool wants one, and the
result is quoted as a whole: these commands are handed to a shell, so an
extension holding a glob character, a quote or a space has to arrive as
a single argument. Quoting it here rather than wrapping it in literal
quotes in the descriptor is also what protects the backslash in ag's
anchored regexp: bare, the shell eats it, and ag ends up matching any
character where a literal dot was meant.
Source Code
;; Defined in ~/.emacs.d/elpa/projectile-20260930.434/projectile.el
(defun projectile--search-ext-argument (desc file-ext)
"Return FILE-EXT as one shell-quoted argument for the tool described by DESC.
DESC is an entry of `projectile--search-tool-descriptors'. The glob is
turned into a regexp and anchored first when the tool wants one, and the
result is quoted as a whole: these commands are handed to a shell, so an
extension holding a glob character, a quote or a space has to arrive as
a single argument. Quoting it here rather than wrapping it in literal
quotes in the descriptor is also what protects the backslash in ag's
anchored regexp: bare, the shell eats it, and ag ends up matching any
character where a literal dot was meant."
(shell-quote-argument
(concat (if (plist-get desc :ext-regexp)
(projectile--search-glob-to-regexp file-ext)
file-ext)
(plist-get desc :ext-anchor))))