From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.help Subject: RE: highlight regular expression in grep window Date: Wed, 4 Sep 2013 13:33:24 -0700 (PDT) Message-ID: References: <84ab5187-0def-45b6-bdb2-87693a1d77e5@googlegroups.com> <2d2fe767-9f72-422c-beb9-5dbed1ec89f8@googlegroups.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1378326846 31876 80.91.229.3 (4 Sep 2013 20:34:06 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 4 Sep 2013 20:34:06 +0000 (UTC) To: Rami A , help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Sep 04 22:34:09 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VHJmB-0001gi-TH for geh-help-gnu-emacs@m.gmane.org; Wed, 04 Sep 2013 22:34:08 +0200 Original-Received: from localhost ([::1]:55226 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VHJmB-0007wv-Go for geh-help-gnu-emacs@m.gmane.org; Wed, 04 Sep 2013 16:34:07 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41891) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VHJln-0007vT-47 for help-gnu-emacs@gnu.org; Wed, 04 Sep 2013 16:33:51 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VHJld-0001KP-H8 for help-gnu-emacs@gnu.org; Wed, 04 Sep 2013 16:33:43 -0400 Original-Received: from userp1040.oracle.com ([156.151.31.81]:23349) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VHJld-0001KJ-9s for help-gnu-emacs@gnu.org; Wed, 04 Sep 2013 16:33:33 -0400 Original-Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by userp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id r84KXQ1e005057 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 4 Sep 2013 20:33:31 GMT Original-Received: from userz7022.oracle.com (userz7022.oracle.com [156.151.31.86]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r84KXPlA022344 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 4 Sep 2013 20:33:25 GMT Original-Received: from abhmt108.oracle.com (abhmt108.oracle.com [141.146.116.60]) by userz7022.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r84KXONq029504; Wed, 4 Sep 2013 20:33:24 GMT In-Reply-To: <2d2fe767-9f72-422c-beb9-5dbed1ec89f8@googlegroups.com> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.8 (707110) [OL 12.0.6680.5000 (x86)] X-Source-IP: acsinet22.oracle.com [141.146.126.238] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 156.151.31.81 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:93246 Archived-At: > 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, wit= h its regexp. Does that help? > My customized grep function is something like: >=20 > 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: >=20 > 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 >=20 > I am sure there should be a way to modify the grep.el functions to achiev= e > 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 templa= te `grep-find-command', which has the hole into which you inserted the regexp. Maybe someone else can help more; sorry.