> If the user forgets to provide a filename to "M-x grep" (as in
> "grep -nH foo") it will run indefinitely waiting for input from
> stdin until killed.  In such cases it's useful to have `null-device'
> appended, even if the grep program supports the option "-H" (which
> has an other purpose anyway).

Sometimes I miss a space between the regexp and the file name,
i.e. instead of `grep -nH foo *' I type `grep -nH foo*' where
`foo*' is interpreted by grep as a regexp with the empty file name.
It takes some time before starting to worry why grep doesn't finish.

`/dev/null' you proposed is of no help.  It causes grep to print the
finishing message `no matches found' which gives the false impression
that the search string was not found by grep.  This is worse than
forcing you to type C-c C-k to kill the grep process that helps you
to discover your mistake.

Maybe grep.el should try to parse the grep command line and warn the
user about a missing file name (e.g. by highlighting the command in
the grep buffer in `compilation-error' face).  This helps to notice
the mistake sooner, but parsing the command is an unreliable method.

-- 
Juri Linkov
http://www.jurta.org/emacs/



_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

Reply via email to