How do I specify multiple file extensions in rgrep?

I tried *. {cc, hh} but it doesn't work (it only works for lgrep). I also tried the method that suggested it e http://compgroups.net/comp.emacs/searching-multiple-file-types-with-rgrep/95027 , but interactive mode seems to prevent me from entering space. Any idea?

+3


source to share


2 answers


*.cc *.hh

is correct. The find command will then use something like:
\( -iname \*.cc -o -iname \*.hh \)

(If you provided a prefix argument, you can review / edit the command before executing it.)



You can enter a space using quoted-insert

:, C-q SPCor just-one-space

:M-SPC

+6


source


I was (desperate) rolling out an ellipse solution:

(defun mrgrep (pattern extensions dir)
     (interactive "ssearch for: \nsextensions (space separated, no *): \nD")
     (setq includes (mapconcat (lambda (ext)
                                 (concat (format "--include=\"\\*%s\"" ext)))
                               (s-split " " extensions)
                               " "))
     (setq cmd (format "grep -ir %s %s %s"
                       includes
                       pattern
                       (concat dir "*")))
     (setq cmd (read-from-minibuffer "run grep like this: " cmd))
     (compilation-start cmd 'grep-mode)
     )

      



but phils explained how to enter space!

0


source







All Articles