I’m trying to run the rgrep command from a small Emacs Lisp utility, but I’m getting an odd error. The command description is:
rgrep is an interactive compiled Lisp function.
(rgrep REGEXP &optional FILES DIR CONFIRM)
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 ingrep-files-aliases', e.g.ch’ is equivalent to `*.[ch]’.
enteringWith C-u prefix, you can edit the constructed shell command line
before it is executed. With two C-u prefixes, directly edit and run
`grep-find-command’.Collect output in a buffer. While find runs asynchronously, you can
use C-x ` (M-x next-error), or RET in the grep output buffer, to go to
the lines where grep found matches.This command shares argument histories with M-x lgrep and M-x
grep-find.
I try to run:
(rgrep "something" "all" "~/projects/")
and I get
*** Eval error *** Wrong type argument: stringp, nil
Obviously all the params are strings, so I cannot understand where is this nil coming from.
I’m running Emacs 23.3 on Debian Testing.
Thanks in advance for your help!
i think it’s because you have no ‘grep-find-template’ defined. this is certainly (having debugged) why the command produces the error on my version. look at the help for that variable.
cheers.
ps. it’s the difference between calling it interactively or not..
..gets set by ‘grep-calc-defaults’ when called interactively
pps. i think you just have to be careful with your call. if no matches are found, you’ll get a ‘Grep exited abnormally with code 123’ error.
..lots of matches!