How can I modify the default FILES pattern in rgrep for C++ mode?
For C mode the default is
*.[ch]. For C++, it is
*.cc *.cxx *.cpp *.C *.CC *.c++.
I would like to change it to
*.cc *.[ch]xx *.[ch]pp *.[CHh] *.CC *.HH *.[ch]++.
Stack Exchange network consists of 181 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.Visit Stack Exchange
Emacs Stack Exchange is a question and answer site for those using, extending or developing Emacs. It only takes a minute to sign up.Sign up to join this community
grep-files-aliases and then use the interface to change the value of this variable.
Alternatively, you could put:
(setf (cdr (assoc "cc" grep-files-aliases)) (assoc "cchh" grep-files-aliases))
For future reference, you could have looked up the help for
rgrep (by typing C-h f
rgrep) where it says:
Recursively grep for REGEXP in FILES in directory tree rooted at DIR. The search is limited to file names matching shell pattern FILES. FILES may use abbreviations defined in
grep-files-aliases, e.g. entering
chis equivalent to
(eval-after-load "grep" '(setf (cdr (assoc "cc" grep-files-aliases)) (cdr (assoc "cchh" grep-files-aliases)))), because
grep-files-aliaseswas void while loading my init file.
greppackage wouldn't be loaded by default.
init.elfile I get the following message upon using
split-string: Wrong type argument: stringp, ("cchh" . "*.cc *.[ch]xx *.[ch]pp *.[CHh] *.CC *.HH *.[ch]++")Oct 12, 2017 at 18:10