unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Nick Roberts <nickrob@snap.net.nz>
Cc: emacs-devel@gnu.org
Subject: RE: grep command doc - point out that you can chain now
Date: Tue, 18 Jul 2006 17:02:32 +1200	[thread overview]
Message-ID: <17596.27496.792600.13733@kahikatea.snap.net.nz> (raw)
In-Reply-To: <EIENLHALHGIMHGDOLMIMGEMOCJAA.drew.adams@oracle.com>

Drew Adams writes:
 >      >     I don't think it should be pointed out in the manual
 >      >     because you would expect it to work.
 >      >
 >      > It never occurred to me, so I think it is worth mentioning in the
 >      > Emacs Manual.  I will add it to the manual.
 > 
 >     Probably because you knew it didn't work in the past.
 > 
 > Yes, I said that myself.

You predicted Richard's reponse?

 > And, I added, also because what you type is apparently not the arguments to
 > the Unix/GNU-Linux `grep' command, but something possibly much richer. Even
 > if someone were not used to Emacs 20 `grep' behavior, if s?he were used to
 > the Unix/GNU-Linux `grep' command, then s?he would expect to be inputting
 > just the `grep' args, no?

Grep uses start-process just like shell-command.  You saw it as natural to
use the latter with a pipe so I'm surprised that you feel it needs
explaining for grep.

Grep failed in the past because grep-use-null-device was automatically t (or
more accurately "/dev/null" was always appended to the end of the command) By
saying that I would expect it to work, I mean I can't see why it wouldn't.
Could you see a reason?  M-x grep says:

Run grep (like this): grep -nH -e 

not

Run grep (with the following arguments): -nH -e

 >     It still doesn't work for users with versions of grep which don't
 >     have the -H option, so they will be confused by your description.
 > 
 > Do you mean Eli's description? I didn't describe it, beyond mentioning
 > piping. Eli gave a real description of what's going on, presumably.

I mean the person to whom the e-mail was addressed (Richard in this case).
Since you only post to the list, I'm often not sure who you're talking to.

 > I didn't know that either (-H), BTW. That too is worth pointing out. IOW,
 > what you type is different for different `grep's - in one case it is the
 > `grep' args; in another case it is "_any_ shell command whose output
 > resembles that of Grep."
 > 
 > Those behavior differences are certainly worth pointing out, unless they are
 > part of the `grep -H' doc. IOW, is what you type the expected arguments for
 > `grep -H', or is it something special that Emacs (only) allows? Does
 > `grep -H'  _itself_ allow "_any_ shell command whose output resembles that
 > of Grep."?
 >
 > If this is part of the behavior of `grep -H' itself, then I guess it
 > wouldn't need to be documented in Emacs. It's not clear to me what the story
 > is. When I do `M-x man RET grep', and look for -H, it says "Print the
 > filename for each match." That can't be what this is about, can it? Yet,
 > with that same `grep' (it says "GNU Project 2002/01/22" in the footer), I
 > get the magical piping. Isn't some explanation necessary? Is this an Emacs
 > `grep' feature or a Unix/GNU-Linux `grep' feature that Emacs manifests?

Behaviour depends on the version of grep and the value of grep-command but
ultimately the value of grep-use-null-device.  It has to do with the fact
that without "-H" grep doesn't output the filename if only one is given
in the input (hence the dummy extra: /dev/null).  I don't which versions
of grep have "-H" or when it was added to GNU/Linux.

-- 
Nick                                           http://www.inet.net.nz/~nickrob

  reply	other threads:[~2006-07-18  5:02 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-17  3:39 grep command doc - point out that you can chain now Drew Adams
2006-07-17  7:26 ` David Kastrup
2006-07-17  8:19   ` Nick Roberts
2006-07-17 15:28     ` Drew Adams
2006-07-17 17:59       ` Eli Zaretskii
2006-07-17 18:20         ` Drew Adams
2006-07-18  0:12     ` Richard Stallman
2006-07-18  2:30       ` Nick Roberts
2006-07-18  4:22         ` Drew Adams
2006-07-18  5:02           ` Nick Roberts [this message]
2006-07-18  5:53             ` Drew Adams
2006-07-18 15:00               ` Richard Stallman
2006-07-18 14:59         ` Richard Stallman
2006-07-18 21:12           ` Nick Roberts
2006-07-19  6:05             ` Richard Stallman
2006-07-19  7:02               ` Nick Roberts
2006-07-19  8:52                 ` Drew Adams
2006-07-19  9:05                   ` Nick Roberts
2006-07-19 21:15                 ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=17596.27496.792600.13733@kahikatea.snap.net.nz \
    --to=nickrob@snap.net.nz \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).