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

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

Re: highlight regular expression in grep window


From: Rami A
Subject: Re: highlight regular expression in grep window
Date: Sat, 8 Feb 2014 11:46:32 -0800 (PST)
User-agent: G2/1.0

On Wednesday, September 4, 2013 1:33:24 PM UTC-7, Drew Adams wrote:
> > 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.
> 
> 
Drew,
I went back and tried using your grep+.el library.
I have a couple of questions:
1. Is it possible to tweak it so it would remove/toggle comments in the grep 
window for a C language based file or assembly?
2. Is there an option to highlight the match in the grep window? "this is 
different than my question asked in this thread." I am really looking to 
highlight each match in a busy grep window.



> 
> 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]