[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: grep-use-null-device

From: Juri Linkov
Subject: Re: grep-use-null-device
Date: Tue, 16 Aug 2005 12:45:17 +0300
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux)

> 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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]