Function: grep-expand-template
grep-expand-template is a byte-compiled function defined in
grep.el.gz.
Signature
(grep-expand-template TEMPLATE &optional REGEXP FILES DIR EXCL MORE-OPTS)
Documentation
Expand grep COMMAND string replacing <C>, <D>, <F>, <R>, and <X>.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/grep.el.gz
(defun grep-expand-template (template &optional regexp files dir excl more-opts)
"Expand grep COMMAND string replacing <C>, <D>, <F>, <R>, and <X>."
(let* ((command template)
(env `((opts . ,(let ((opts more-opts))
(when (and case-fold-search
(isearch-no-upper-case-p regexp t))
(push "-i" opts))
(cond
((eq grep-highlight-matches 'always)
(push "--color=always" opts))
((eq grep-highlight-matches 'auto)
(push "--color=auto" opts)))
opts))
(excl . ,excl)
(dir . ,dir)
(files . ,files)
(regexp . ,regexp)))
(case-fold-search nil))
(dolist (kw grep-expand-keywords command)
(if (string-match (car kw) command)
(setq command
(replace-match
(or (if (symbolp (cdr kw))
(eval (cdr kw) env)
(save-match-data (eval (cdr kw) env)))
"")
t t command))))))