* How to avoid /dev/null at the end of grep-command
@ 2007-03-02 9:20 al.coyote
2007-03-02 13:49 ` Eli Zaretskii
[not found] ` <mailman.334.1172843352.7795.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 4+ messages in thread
From: al.coyote @ 2007-03-02 9:20 UTC (permalink / raw)
To: help-gnu-emacs
Hello,
When running M-x grep, emacs adds a /dev/null after the list of files.
That's a secure idea most of the times, but when running complex grep
command, this is annoying. For example something like:
grep -n -A2 my_function * | grep -n '\n'
won't work, as emacs will transform this command as
grep -n -A2 my_function * | grep -n '\n' /dev/null
I can add /dev/stdin to the second grep, but the file name will be
garbaged too.
Setting a default grep command does not solve the problem.
Any solution to avoid the /dev/null, without modifying compile.el ?
Thanks in advance.
Al
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: How to avoid /dev/null at the end of grep-command
2007-03-02 9:20 How to avoid /dev/null at the end of grep-command al.coyote
@ 2007-03-02 13:49 ` Eli Zaretskii
[not found] ` <mailman.334.1172843352.7795.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2007-03-02 13:49 UTC (permalink / raw)
To: help-gnu-emacs
> From: al.coyote@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.
^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <mailman.334.1172843352.7795.help-gnu-emacs@gnu.org>]
* Re: How to avoid /dev/null at the end of grep-command
[not found] ` <mailman.334.1172843352.7795.help-gnu-emacs@gnu.org>
@ 2007-03-03 8:09 ` al.coyote
2007-03-03 10:26 ` Eli Zaretskii
0 siblings, 1 reply; 4+ messages in thread
From: al.coyote @ 2007-03-03 8:09 UTC (permalink / raw)
To: help-gnu-emacs
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: How to avoid /dev/null at the end of grep-command
2007-03-03 8:09 ` al.coyote
@ 2007-03-03 10:26 ` Eli Zaretskii
0 siblings, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2007-03-03 10:26 UTC (permalink / raw)
To: help-gnu-emacs
> From: al.coyote@gmail.com
> Date: 3 Mar 2007 00:09:46 -0800
> >
> > 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.)
>
> I'm using emacs 21 on linux, but as this feature comes from compile.el
> the behaviour should be the same on most architectures.
You see, the problem is, I use the development version of Emacs (which
will shortly become Emacs 22.1), where there are other solutions.
Many Emacs users use this development version as well. That is why
version information is important.
> Thanks for your suggestion, I have found another one.
Glad you solved this.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-03-03 10:26 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-02 9:20 How to avoid /dev/null at the end of grep-command al.coyote
2007-03-02 13:49 ` Eli Zaretskii
[not found] ` <mailman.334.1172843352.7795.help-gnu-emacs@gnu.org>
2007-03-03 8:09 ` al.coyote
2007-03-03 10:26 ` Eli Zaretskii
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.