[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Search within function for text
From: |
Louis Höfler |
Subject: |
Re: Search within function for text |
Date: |
Tue, 24 Mar 2015 17:53:00 +0100 |
User-agent: |
Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 |
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