From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.help Subject: Re: Unexpected behavior of grep-use-null-device in non-interactive mode Date: Tue, 23 Feb 2021 19:24:16 +0200 Message-ID: <83wnuyu27z.fsf@gnu.org> References: <030c01d7096e$82aa7260$87ff5720$@free.fr> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30300"; mail-complaints-to="usenet@ciao.gmane.io" To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Tue Feb 23 18:25:00 2021 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lEbQi-0007nv-Q0 for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 23 Feb 2021 18:25:00 +0100 Original-Received: from localhost ([::1]:39558 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lEbQh-0002nZ-Sg for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 23 Feb 2021 12:24:59 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51194) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lEbQ9-0002mP-KK for help-gnu-emacs@gnu.org; Tue, 23 Feb 2021 12:24:25 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:48476) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lEbQ9-0005dM-DF for help-gnu-emacs@gnu.org; Tue, 23 Feb 2021 12:24:25 -0500 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:1464 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1lEbQ8-0003Yn-LV for help-gnu-emacs@gnu.org; Tue, 23 Feb 2021 12:24:25 -0500 In-Reply-To: <030c01d7096e$82aa7260$87ff5720$@free.fr> (david.chappaz@free.fr) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:128216 Archived-At: > From: > Date: Mon, 22 Feb 2021 15:00:24 -0800 > > Why is /dev/null added to the command at step 3 ? > > Is this a bug ? Or perhaps my expectations are not quite right ? The function that auto-detects null-device support is only called when you invoke the command interactively. And the doc string actually says so: (defcustom grep-use-null-device 'auto-detect "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. In interactive usage, the actual value of this variable is set up ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ by `grep-compute-defaults' ^^^^^^^^^^^^^^^^^^^^^^^^^ Why do you need to call 'grep' noninteractively, and still want it to show the hits as if it were an interactive call?