From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?UTF-8?B?TG91aXMgSMO2Zmxlcg==?= Newsgroups: gmane.emacs.help Subject: Re: Search within function for text Date: Tue, 24 Mar 2015 17:53:00 +0100 Message-ID: <5511966C.1080800@mathematek.de> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1427218939 19463 80.91.229.3 (24 Mar 2015 17:42:19 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 24 Mar 2015 17:42:19 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Mar 24 18:42:11 2015 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 1YaSq2-0001hN-C5 for geh-help-gnu-emacs@m.gmane.org; Tue, 24 Mar 2015 18:42:02 +0100 Original-Received: from localhost ([::1]:33713 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YaSq1-0001FH-Ky for geh-help-gnu-emacs@m.gmane.org; Tue, 24 Mar 2015 13:42:01 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54086) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YaS4h-00073a-BY for help-gnu-emacs@gnu.org; Tue, 24 Mar 2015 12:53:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YaS4d-0007U8-1Z for help-gnu-emacs@gnu.org; Tue, 24 Mar 2015 12:53:07 -0400 Original-Received: from mathematek.de ([5.9.124.170]:57981) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YaS4c-0007TN-Ro for help-gnu-emacs@gnu.org; Tue, 24 Mar 2015 12:53:02 -0400 Original-Received: from [192.168.2.100] (p3E9E91CC.dip0.t-ipconnect.de [62.158.145.204]) (Authenticated sender: louis.hoefler@mathematek.de) by mathematek.de (Postfix) with ESMTPSA id 3E523601C3B for ; Tue, 24 Mar 2015 17:53:00 +0100 (CET) User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 5.9.124.170 X-Mailman-Approved-At: Tue, 24 Mar 2015 13:41:45 -0400 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:103293 Archived-At: Am 24.03.2015 um 14:28 schrieb Glen Stark: > Hi Everyone. > > I would like to find all occurences of a bit of text that fall within a > certain function name. > This is possible with regex. If you want to search within the current buffer use (re-search-forward "foo() \{.* bar.*\}") The task is more difficult if you want to search within all files in a directory. You can either use find -type f -name "*.cpp" | grep "foo() \{.* bar.*\}" Or within emacs, by interfacing find and grep. I also developed erfind for this purpose. It does not need any thirdparty application and in addition can work on windows and linux. Download it here, copy it to your emacs seach path: http://scm.mathematek.de/repos.cgi/emacside/zip/emacside.zip Then load the packages with (require 'eide-filetools) (require 'eide-erfind) You can modify the source for your needs, but in your case maybe this should work M+x erfind-cwd foo() \{.* bar.*\} Hope this helped a little, Louis