unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "Louis Höfler" <louis.hoefler@mathematek.de>
To: help-gnu-emacs@gnu.org
Subject: Re: Search within function for text
Date: Tue, 24 Mar 2015 17:53:00 +0100	[thread overview]
Message-ID: <5511966C.1080800@mathematek.de> (raw)
In-Reply-To: <QDdQw.393363$pU1.53944@fx24.am4>

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 <RET> foo() \{.* bar.*\} <RET>

Hope this helped a little, Louis



  parent reply	other threads:[~2015-03-24 16:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-24 13:28 Search within function for text Glen Stark
2015-03-24 15:21 ` Drew Adams
2015-03-24 15:44 ` Tassilo Horn
2015-03-24 16:53 ` Louis Höfler [this message]
2015-03-24 16:57 ` Louis Höfler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5511966C.1080800@mathematek.de \
    --to=louis.hoefler@mathematek.de \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).