unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#44409: Example in manual no longer works
@ 2020-11-03  5:28 積丹尼 Dan Jacobson
  2020-11-03  7:16 ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: 積丹尼 Dan Jacobson @ 2020-11-03  5:28 UTC (permalink / raw)
  To: 44409

(info "(emacs) Grep Searching") Says

   For instance, you can chain ‘grep’ commands, like this: ...

But the example it then gives is for older emacs versions.

Newer emacs versions' grep string contains "--null" (proof: try
$ emacs -f grep
) which will cause the example to fail.

How can one rewrite the example to work with newer emacs versions?





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#44409: Example in manual no longer works
  2020-11-03  5:28 bug#44409: Example in manual no longer works 積丹尼 Dan Jacobson
@ 2020-11-03  7:16 ` Eli Zaretskii
  2020-11-03  7:47   ` 積丹尼 Dan Jacobson
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2020-11-03  7:16 UTC (permalink / raw)
  To: 44409, jidanni

On November 3, 2020 7:28:41 AM GMT+02:00, "積丹尼 Dan Jacobson" <jidanni@jidanni.org> wrote:
> (info "(emacs) Grep Searching") Says
> 
>    For instance, you can chain ‘grep’ commands, like this: ...
> 
> But the example it then gives is for older emacs versions.
> 
> Newer emacs versions' grep string contains "--null" (proof: try
> $ emacs -f grep
> ) which will cause the example to fail.
> 
> How can one rewrite the example to work with newer emacs versions?

I just tried the example in the manual with a recent version of Enacs, and the example works just fine.  So in what sense doesn't the example work for you?  And what is the significance of --null for this purpose?

IOW, I see no reason to rewrite the example.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#44409: Example in manual no longer works
  2020-11-03  7:16 ` Eli Zaretskii
@ 2020-11-03  7:47   ` 積丹尼 Dan Jacobson
  2020-11-03 11:16     ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: 積丹尼 Dan Jacobson @ 2020-11-03  7:47 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 44409

$ grep --color -nH --null -e a /etc/motd
/etc/motd:2:The programs included with the Debian GNU/Linux system are free software;
/etc/motd:3:the exact distribution terms for each program are described in the...
$ grep --color -nH --null -e a /etc/motd | grep x
Binary file (standard input) matches

>>>>> "EZ" == Eli Zaretskii <eliz@gnu.org> writes:
EZ> And what is the significance of --null for this purpose?

     grep -nH -e

is not the current emacs prompt. It is an older emacs prompt.

The current emacs prompt is

     grep --color -nH --null -e

You can verify this via
$ emacs -f grep





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#44409: Example in manual no longer works
  2020-11-03  7:47   ` 積丹尼 Dan Jacobson
@ 2020-11-03 11:16     ` Eli Zaretskii
  2020-11-03 23:32       ` 積丹尼 Dan Jacobson
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2020-11-03 11:16 UTC (permalink / raw)
  To: 積丹尼 Dan Jacobson; +Cc: 44409

On November 3, 2020 9:47:37 AM GMT+02:00, "積丹尼 Dan Jacobson" <jidanni@jidanni.org> wrote:
> $ grep --color -nH --null -e a /etc/motd
> /etc/motd:2:The programs included with the Debian GNU/Linux system are
> free software;
> /etc/motd:3:the exact distribution terms for each program are
> described in the...
> $ grep --color -nH --null -e a /etc/motd | grep x
> Binary file (standard input) matches

The example in the manual doesn't mention /etc/motd of any other binary file.  It uses text files, where this issue doesn't exist.

If you are seeking information for how to use Grep with binary files, you should be looking in the Grep manual, not the Emacs manual.

> >>>>> "EZ" == Eli Zaretskii <eliz@gnu.org> writes:
> EZ> And what is the significance of --null for this purpose?
> 
>      grep -nH -e
> 
> is not the current emacs prompt. It is an older emacs prompt.
> 
> The current emacs prompt is
> 
>      grep --color -nH --null -e

Yes, but you need to edit that prompt anyway in order to type the command with a pipe, so the original prompt doesn't matter much.

I see no problem here that needs tk be fixed.






^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#44409: Example in manual no longer works
  2020-11-03 11:16     ` Eli Zaretskii
@ 2020-11-03 23:32       ` 積丹尼 Dan Jacobson
  2020-11-04  3:24         ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: 積丹尼 Dan Jacobson @ 2020-11-03 23:32 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 44409

>>>>> "EZ" == Eli Zaretskii <eliz@gnu.org> writes:

EZ> The example in the manual doesn't mention /etc/motd of any other binary file.  It uses text files, where this issue doesn't exist.

Since when is /etc/motd a binary file?

If it were a binary file, the first grep,

>> $ grep --color -nH --null -e a /etc/motd
>> /etc/motd:2:The programs included with the Debian GNU/Linux system are free software;
>> /etc/motd:3:the exact distribution terms for each program are
>> described in the...

would fail.

But it doesn't. Only the second grep fails:

>> $ grep --color -nH --null -e a /etc/motd | grep x
>> Binary file (standard input) matches

So we see the issue indeed exists with text files!!

Double proof:

$ file /etc/motd
/etc/motd: ASCII text

Thus we see that one cannot simply slap

 "| grep bar | grep toto"

onto the end of a working grep command anymore!

Back when the manual was written, one could. But not anymore.

EZ> Yes, but you need to edit that prompt anyway in order to type the
EZ> command with a pipe, so the original prompt doesn't matter much.

No!

In the past one could simply slap the pipe(s) on to the back.

Now that no longer works.

Therefore the example needs to be rewritten to make it work again.

(Or specific instructions need to be given: "Be sure to remove any
'--null' that emacs has stuck in, for this example to work.")





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#44409: Example in manual no longer works
  2020-11-03 23:32       ` 積丹尼 Dan Jacobson
@ 2020-11-04  3:24         ` Eli Zaretskii
  0 siblings, 0 replies; 6+ messages in thread
From: Eli Zaretskii @ 2020-11-04  3:24 UTC (permalink / raw)
  To: 積丹尼 Dan Jacobson; +Cc: 44409-done

> From: 積丹尼 Dan Jacobson <jidanni@jidanni.org>
> Cc: bug-gnu-emacs@gnu.org, 44409@debbugs.gnu.org
> Date: Wed, 04 Nov 2020 07:32:42 +0800
> 
> >>>>> "EZ" == Eli Zaretskii <eliz@gnu.org> writes:
> 
> EZ> The example in the manual doesn't mention /etc/motd of any other binary file.  It uses text files, where this issue doesn't exist.
> 
> Since when is /etc/motd a binary file?

I didn't say it was.

> >> $ grep --color -nH --null -e a /etc/motd | grep x
> >> Binary file (standard input) matches
> 
> So we see the issue indeed exists with text files!!

No, it exists if you use Grep incorrectly.

> EZ> Yes, but you need to edit that prompt anyway in order to type the
> EZ> command with a pipe, so the original prompt doesn't matter much.
> 
> No!
> 
> In the past one could simply slap the pipe(s) on to the back.
> 
> Now that no longer works.
> 
> Therefore the example needs to be rewritten to make it work again.

The example already works without any changes, so it doesn't need to
be rewritten.

> (Or specific instructions need to be given: "Be sure to remove any
> '--null' that emacs has stuck in, for this example to work.")

That's the stuff for Grep manual, not for Emacs.

So I don't see any problem here to fix, and I'm closing this bug
report.





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-11-04  3:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-03  5:28 bug#44409: Example in manual no longer works 積丹尼 Dan Jacobson
2020-11-03  7:16 ` Eli Zaretskii
2020-11-03  7:47   ` 積丹尼 Dan Jacobson
2020-11-03 11:16     ` Eli Zaretskii
2020-11-03 23:32       ` 積丹尼 Dan Jacobson
2020-11-04  3:24         ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).