Subject: bug#46801: Autodetection of grep-use-null-device

From: <[email-masked]>
Date: Fri, 26 Feb 2021 09:10:51 -0800

Hi,

Here is a simple recipe:

1/ Start emacs with --no-init

2/ Check that grep-use-null-device is set to 'auto-detect'

3/ Execute non-interactively

(grep "grep --color -nH --null -e something")

The command that's echoed in the grep buffer is:

grep --color -nH --null -e something /dev/null

4/ I can see that grep-use-null-device has been set to nil

This suggests that automatic detection of grep-use-null-device

has taken place. Is this expected after non-interactive invocation ?

The documentation seems to suggest that automatic detection of

grep-use-null-device should  take place on the first *interactive*

call, but not before that. Perhaps I don't read the documentation

correctly though, it's very possible !

However, if automatic detection of grep-use-null-device after
non-interactive 

Invocation is the correct behavior, then why was /dev/null added to the

command despite grep-use-null-device being set to nil ?

5/ Execute non-interactively the same command again:

(grep "grep --color -nH --null -e something")

The command that's echoed in the grep buffer now is:

grep --color -nH --null -e something

This time round, /dev/null is not present. At least this is consistent with

grep-use-null-device being set to nil.

What doesn't seem right is that the echoed command is not the same as

that from step 3/

Any thoughts or comments ?

Thanks !

David