help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: How to avoid /dev/null at the end of grep-command


From: al . coyote
Subject: Re: How to avoid /dev/null at the end of grep-command
Date: 3 Mar 2007 00:09:46 -0800
User-agent: G2/1.0

Hello Eli,

On 2 mar, 14:49, Eli Zaretskii <e...@gnu.org> wrote:
> > From: al.coy...@gmail.com
> > Date: 2 Mar 2007 01:20:35 -0800
>
> > Any solution to avoid the /dev/null, without modifying compile.el ?
>
> I'm guessing that this is Emacs 21.x; if not, holler.  (I shouldn't be
> guessing, btw: please always state your Emacs version and the OS.)
>
> One way to work around this is to write a wrapper command that binds
> null-device to nil and then invokes the original `grep' command.  You
> can put this command in your .emacs.

I'm using emacs 21 on linux, but as this feature comes from compile.el
the behaviour should be the same on most architectures.
This behaviour is very old, maybe version 20 and even 19 did have it
(sorry I don't have these versions handy).

Thanks for your suggestion, I have found another one. Just end your
complex command with cat -, this command will do nothing except
protect from the /dev/null
So M-x grep with grep -n -A2 printf * | grep '\\n' | sed -e s/-/:/g |
cat -
will be transformed by emacs into
grep -n -A2 printf * | grep '\\n' | sed -e s/-/:/g | cat - /dev/null
which will do the job.

Al




reply via email to

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