[Top][All Lists]

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

RE: highlight regular expression in grep window

From: Drew Adams
Subject: RE: highlight regular expression in grep window
Date: Wed, 4 Sep 2013 13:33:24 -0700 (PDT)

> I am not even worried about "highlighting" the regexp, I just want a way to
> find out what the expression that I grepped for once I switch to that
> window.

`g' in that window, then `M-p' should show you the last `grep' command, with
its regexp.  Does that help?

> My customized grep function is something like:
> find . -type d \( -name unix -o -name "*_sim" -o -name RCS -o -name CVS -o -
> name SCCS \) -prune -o -type f \! -name \*\~ \! -name \*\,v \! -name s.\* \!
> -name .\#\* -name \*.\[sch\] -print | xargs -e grep -n -i  mem_test
> /dev/null

Ah, so this is not about `M-x grep'.  I guess it's about `grep-find'.
Still, repeating the command and using `M-p' should show you the previous
command used, including its regexp.

> So the token "mem_test" which I am looking for would be invisible because it
> is at the end of that string.  I just want something like:
> The token I am grepping on is: mem_test
> or, as I mentioned earlier to include that token at the bottom along with
> the title of the buffer "*grep* mem_test
> I am sure there should be a way to modify the grep.el functions to achieve
> that somehow.

The regexp you typed was not seen as such by Emacs.  All that was seen was
the entire input command, including that regexp.  To extract the regexp I
think you would need to add code that matches that input against the template
`grep-find-command', which has the hole into which you inserted the regexp.

Maybe someone else can help more; sorry.

reply via email to

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