unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* M-x grep: broken buffer with pipes
@ 2009-12-30 20:06 Sam Steingold
  2009-12-31  0:32 ` Juri Linkov
  0 siblings, 1 reply; 4+ messages in thread
From: Sam Steingold @ 2009-12-30 20:06 UTC (permalink / raw)
  To: emacs-devel

For specificity, visit the emacs/lisp/grep.el file and do
M-x grep RET 'defvar.*buffer' *.el RET
(I.e., the shell command is "grep -nH -e 'defvar.*buffer' *.el").
the *grep* buffer contains about 50 matches, each clickable,
and a line typically looks like
<file>:<line>:(<defvar foo-buffer>-zot nil
where <file> is green, <line> is reddish, <defvar foo-buffer> is yellow.
Everything is great, clicking on the file name visits the file.

Now, in the same grep.el buffer, do this:
M-x grep RET 'defvar.*buffer' *.el | grep -v '"' RET
(the shell command is "grep -nH -e 'defvar.*buffer' *.el | grep -v '"'")
The *grep* buffer now contains (correctly) about 10% fewer matches, and <file> 
and <line> are still good, but the <defvar foo-buffer> part is no longer yellow.
That lack of match highlighting is not a big deal, however, there is a hugely 
more horrible problem: one cannot click on the file name to visit the file.
When you click on the file name, the file selection menu appears, with the 
default being ^[[K<file> where "^[" stands for the escape character (ESC (27, 
#o33, #x1b)) and <file> is the file name you clicked on.
So, where do these 3 spurious characters (ESC [ K) come from?





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

* Re: M-x grep: broken buffer with pipes
  2009-12-30 20:06 M-x grep: broken buffer with pipes Sam Steingold
@ 2009-12-31  0:32 ` Juri Linkov
  2009-12-31  0:50   ` Sam Steingold
  0 siblings, 1 reply; 4+ messages in thread
From: Juri Linkov @ 2009-12-31  0:32 UTC (permalink / raw)
  To: Sam Steingold; +Cc: emacs-devel

> M-x grep RET 'defvar.*buffer' *.el | grep -v '"' RET
> (the shell command is "grep -nH -e 'defvar.*buffer' *.el | grep -v '"'")
> The *grep* buffer now contains (correctly) about 10% fewer matches, and
> <file> and <line> are still good, but the <defvar foo-buffer> part is no
> longer yellow.

You can customize `grep-highlight-matches' to the value `always'
if you are content with the problems it might cause like
http://thread.gmane.org/gmane.emacs.devel/83316

> That lack of match highlighting is not a big deal, however, there is
> a hugely more horrible problem: one cannot click on the file name to visit
> the file.
> When you click on the file name, the file selection menu appears, with the
> default being ^[[K<file> where "^[" stands for the escape character (ESC
> (27, #o33, #x1b)) and <file> is the file name you clicked on.
> So, where do these 3 spurious characters (ESC [ K) come from?

I guess these escape sequences come from the grep switch --color that
outputs them around the matched strings.  However, I can't reproduce your
problem.  When I click on the file name that lacks of match highlighting,
it still visits the source file.  What grep version do you have?

-- 
Juri Linkov
http://www.jurta.org/emacs/




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

* Re: M-x grep: broken buffer with pipes
  2009-12-31  0:32 ` Juri Linkov
@ 2009-12-31  0:50   ` Sam Steingold
  2009-12-31  1:08     ` Juri Linkov
  0 siblings, 1 reply; 4+ messages in thread
From: Sam Steingold @ 2009-12-31  0:50 UTC (permalink / raw)
  To: emacs-devel

Juri Linkov wrote:
>> M-x grep RET 'defvar.*buffer' *.el | grep -v '"' RET
>> (the shell command is "grep -nH -e 'defvar.*buffer' *.el | grep -v '"'")
>> The *grep* buffer now contains (correctly) about 10% fewer matches, and
>> <file> and <line> are still good, but the <defvar foo-buffer> part is no
>> longer yellow.
> 
> You can customize `grep-highlight-matches' to the value `always'
> if you are content with the problems it might cause like
> http://thread.gmane.org/gmane.emacs.devel/83316

this happens with "emacs -q".
i.e., the default value of this variable is incorrect.

indeed, when I customize this variable to nil, the problem goes away.

>> That lack of match highlighting is not a big deal, however, there is
>> a hugely more horrible problem: one cannot click on the file name to visit
>> the file.
>> When you click on the file name, the file selection menu appears, with the
>> default being ^[[K<file> where "^[" stands for the escape character (ESC
>> (27, #o33, #x1b)) and <file> is the file name you clicked on.
>> So, where do these 3 spurious characters (ESC [ K) come from?
> 
> I guess these escape sequences come from the grep switch --color that
> outputs them around the matched strings.  However, I can't reproduce your
> problem.  When I click on the file name that lacks of match highlighting,
> it still visits the source file.  What grep version do you have?

grep (GNU grep) 2.5.1





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

* Re: M-x grep: broken buffer with pipes
  2009-12-31  0:50   ` Sam Steingold
@ 2009-12-31  1:08     ` Juri Linkov
  0 siblings, 0 replies; 4+ messages in thread
From: Juri Linkov @ 2009-12-31  1:08 UTC (permalink / raw)
  To: Sam Steingold; +Cc: emacs-devel

>> You can customize `grep-highlight-matches' to the value `always'
>> if you are content with the problems it might cause like
>> http://thread.gmane.org/gmane.emacs.devel/83316
>
> this happens with "emacs -q".
> i.e., the default value of this variable is incorrect.
>
> indeed, when I customize this variable to nil, the problem goes away.

The current default `auto' is chosen to cause less problems than
with the value `always'.

>> I guess these escape sequences come from the grep switch --color that
>> outputs them around the matched strings.  However, I can't reproduce your
>> problem.  When I click on the file name that lacks of match highlighting,
>> it still visits the source file.  What grep version do you have?
>
> grep (GNU grep) 2.5.1

GNU grep 2.5.1 uses a different method of match highlighting.
grep 2.5.1 relies on the environment variable `GREP_COLOR'
whereas grep 2.5.2 and later use the variable `GREP_COLORS'.

However, when I tried to reproduce this with GNU grep 2.5.1,
it still correctly visits the source file.  So I don't understand
what it going on.  Anyone else can reproduce this problem?

-- 
Juri Linkov
http://www.jurta.org/emacs/




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

end of thread, other threads:[~2009-12-31  1:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-30 20:06 M-x grep: broken buffer with pipes Sam Steingold
2009-12-31  0:32 ` Juri Linkov
2009-12-31  0:50   ` Sam Steingold
2009-12-31  1:08     ` Juri Linkov

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