emacs-devel
[Top][All Lists]
Advanced

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

grep-use-null-device


From: Emilio Lopes
Subject: grep-use-null-device
Date: Mon, 15 Aug 2005 17:41:39 +0200
User-agent: Emacs Gnus

The documentation of this variable says:

   grep-use-null-device's value is nil

   If t, append the value of `null-device' to `grep' commands.
   This is done to ensure that the output of grep includes the filename of
   any match in the case where only a single file is searched, and is not
   necessary if the grep program used supports the `-H' option.

   The default value of this variable is set up by `grep-compute-defaults';
   call that function before using this variable in your program.

   You can customize this variable.

   Defined in `grep'.


If I understood it right, it says that I don't need a "/dev/null"
appended to my grep commands if my grep program supports the
optionĀ "-H".

Let's see:

   ~% grep --version
   grep (GNU grep) 2.5.1

   Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.
   This is free software; see the source for copying conditions. There is NO
   warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

   ~% grep --help | grep -- -H
     -H, --with-filename       print the filename for each match

So, my grep program supports "-H" but it apparently has not the
expected semantics.

As a result, if I forget to provide a filename to "M-x grep" it will run
forever, waiting for me to kill it.

Do I have the "wrong" grep?

Is there a case where having a `null-device' too much will hurt?





reply via email to

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