unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* find-grep makes raw terminal ANSI
@ 2007-11-12 19:13 jidanni
  2007-11-13 20:03 ` Richard Stallman
  0 siblings, 1 reply; 3+ messages in thread
From: jidanni @ 2007-11-12 19:13 UTC (permalink / raw)
  To: bug-gnu-emacs

Why when I append additional filters on find-grep, are the results
flaky? Ah, one day instead of those filters, I tried cat -v:

(find-grep "find . -type f -print0 | xargs -0 -e grep -nH -e table|cat -v")
./article-category.html:298: </^[[01;31mtable^[[m>

That's right: raw terminal highlighting characters right there in the
output. Gentlemen, I'm sure this is the wrong layer to do this. Or at
least warn in the docstring to find-grep. emacs-version "22.1.1"




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

* Re: find-grep makes raw terminal ANSI
  2007-11-12 19:13 find-grep makes raw terminal ANSI jidanni
@ 2007-11-13 20:03 ` Richard Stallman
  2007-11-14  4:04   ` jidanni
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Stallman @ 2007-11-13 20:03 UTC (permalink / raw)
  To: jidanni; +Cc: bug-gnu-emacs

    (find-grep "find . -type f -print0 | xargs -0 -e grep -nH -e table|cat -v")
    ./article-category.html:298: </^[[01;31mtable^[[m>

    That's right: raw terminal highlighting characters right there in the
    output. Gentlemen, I'm sure this is the wrong layer to do this.

I am lost.  Which layer are you talking about, and what does it do?




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

* Re: find-grep makes raw terminal ANSI
  2007-11-13 20:03 ` Richard Stallman
@ 2007-11-14  4:04   ` jidanni
  0 siblings, 0 replies; 3+ messages in thread
From: jidanni @ 2007-11-14  4:04 UTC (permalink / raw)
  To: rms; +Cc: bug-gnu-emacs

>>>>> "r" == Richard Stallman <rms@gnu.org> writes:

r> I am lost.

Allow us to take the case of
(find-grep "find /etc/passwd -type f -print0 | xargs -0 -e grep -nH -e roo")
which works fine unless one then smacks at the end an additional filter:
(find-grep "find /etc/passwd -type f -print0 | xargs -0 -e grep -nH -e roo|grep :root")
Grep finished with no matches found at Wed Nov 14 12:03:40
whereas the same command in the shell finds something:
$ find /etc/passwd -type f -print0 | xargs -0 -e grep -nH -e roo|grep :root
/etc/passwd:1:root:x:0:0:root:/root:/bin/bash

Thus the user walks away thinking there was nothing to be found, when
all along what is happening is that ANSI terminal control characters
are being injected, as can be seen with
(find-grep "find /etc/passwd -type f -print0 | xargs -0 -e grep -nH -e roo|cat -v")

Thus the user is mislead thinking he can merely extend the UNIX filter
by another pipe, but instead unwittingly throwing away valid matches.

ANSI terminal codes have no business being injected at this layer of
the program.

Wait, I see what is going on,
12 matches for "highlight" in buffer: grep.el.gz
7 matches for "color" in buffer: grep.el.gz,
(including "The deprecated environment variable GREP_COLOR." as noted
on grep(1).)

It would be much better to put --color right there in the command line
where the user can be aware of what is going on. But that line is
already crowded.

Anyway, just wanted to let you know "I told the boss that we have no
record of that client, when all along that color jazz
undermined my extra search filter. How was I to know?"




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

end of thread, other threads:[~2007-11-14  4:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-12 19:13 find-grep makes raw terminal ANSI jidanni
2007-11-13 20:03 ` Richard Stallman
2007-11-14  4:04   ` jidanni

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).