From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: grep-use-null-device Date: Tue, 16 Aug 2005 12:45:17 +0300 Organization: JURTA Message-ID: <87mznichva.fsf@jurta.org> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1124191857 4213 80.91.229.2 (16 Aug 2005 11:30:57 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 16 Aug 2005 11:30:57 +0000 (UTC) Cc: rms@gnu.org, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Aug 16 13:30:53 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1E4zeI-0005jE-6S for ged-emacs-devel@m.gmane.org; Tue, 16 Aug 2005 13:30:30 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1E4zhh-0001QX-Q5 for ged-emacs-devel@m.gmane.org; Tue, 16 Aug 2005 07:34:01 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1E4zAO-0007Kv-Dq for emacs-devel@gnu.org; Tue, 16 Aug 2005 06:59:37 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1E4yp0-0002Sh-2q for emacs-devel@gnu.org; Tue, 16 Aug 2005 06:37:30 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1E4yhr-0000Vj-BM for emacs-devel@gnu.org; Tue, 16 Aug 2005 06:30:07 -0400 Original-Received: from [194.126.101.111] (helo=mail.neti.ee) by monty-python.gnu.org with esmtp (Exim 4.34) id 1E4ypB-0001ng-TS; Tue, 16 Aug 2005 06:37:42 -0400 Original-Received: from mail.neti.ee (80-235-32-216-dsl.mus.estpak.ee [80.235.32.216]) by Relayhost1.neti.ee (Postfix) with ESMTP id 980BE1FBD; Tue, 16 Aug 2005 13:21:45 +0300 (EEST) Original-To: Emilio Lopes In-Reply-To: (Emilio Lopes's message of "Tue, 16 Aug 2005 09:15:07 +0200") User-Agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux) X-Virus-Scanned: by amavisd-new-2.2.1 (20041222) (Debian) at neti.ee X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:42112 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:42112 > 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/