On Nov 17, 4:09 am, blandest <
valentin.ba...@gmail.com> wrote:
> On Nov 17, 11:19 am, Xah Lee <
xah...@gmail.com> wrote:
> > Gnu Emacs Bug: rgrep, “find: invalid predicate `-nam'”
>
> > this seems to be a bug. Steps to reproduce:
>
> > Start GNU Emacs with -Q.
> > call “rgrep”. Search for anything.
> > You get the following result:
>
> > -*- mode: grep; default-directory: "c:/Users/h3/web/xahlee_org/emacs/"
> > -*-
> > Grep started at Thu Nov 17 00:49:37
>
> > find . "(" -path "*/SCCS" -o -path "*/RCS" -o -path "*/CVS" -o -path
> > ...
> > "*.pyc" -o -name "*.pyo" ")" -prune -o -type f "(" -iname "*" -o -
> > iname ".*" ")" -exec grep -i -n "grep" {} NUL ";"
> > FIND: Parameter format not correct
> > ...
> > find: invalid predicate `-nam'
>
> You are probably calling the wrong `find'. Instead of the GNU find you
> are most likely using the one built in Windows' cmd.exe.
> If this is indeed the cause, you will need to adjust your PATH
> environment or put an appropriate find.exe in the System dir specific
> to your Windows version.
Thanks. Great answer.
That seems to lead somewhere. After i manually set PATH and exec-path
(probably just the latter is necessary), then the problem went away,
but a different problem occurs.
In the output, for each file that doesn't contains the search text, it
shows:
grep: NUL: No such file or directory
grep: NUL: No such file or directory
grep: NUL: No such file or directory
...
it's curious, today i was writing a tutorial on all the ways to search
text in files.
occur (alias list-matching-lines), grep, rgrep, lgrep, find-dired, ...
it's somewhat inconsistent.
list-matching-lines uses elisp, while the others relies on unix util.
The interface also isn't consistent. e.g. grep and grep-find (alias
find-grep) both directly prompt you to enter unix command in one shot.
But find-dired, rgrep, lgrep, do several prompts asking for search
string, file extension, then dir (though, still based on unix command
syntax as they are just passed to unix shell. e.g. when asking file
extension, you use unix wildcard such as *html instead of regex.)
also, occur shows result with search term highlighted. Nice. But grep
command doesn't.
It seems to me, they could all use elisp, with a single code engine,
and with the same interface. The files to be searched can be from
buffer list or dired marked files, or entered from prompt with emacs
regex.
The output can be a output like occur or can be dired list or buffer
list.
e.g. list-matching-lines, and then
list-matching-lines-directory with options to do nested dirs, and
options to use a pattern to filter files to search for, or options to
get marked files in dired, and also options to show result as list in
dired.
has someone written multi-file grep in elisp? am thinking that someone
must have.
Xah