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

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

Re: How to search all open buffers?


From: Eli Zaretskii
Subject: Re: How to search all open buffers?
Date: Fri, 31 Aug 2007 00:18:24 +0300

> From: kj <socyl@987jk.com.invalid>
> Date: Thu, 30 Aug 2007 16:46:27 +0000 (UTC)
> 
> I run into this *all* the time: I've been coding for several days,
> working on 20-30 files simultaneously, and I need to get back to
> the one among these many buffers that contains a particular string
> or regex.

Then just search the files for that regex, e.g. with the Dired's `A'
command.  Emacs will notice when a particular file is already in a
buffer and will search that buffer instead.

> The nature of this string or regex varies: most commonly
> it's the name of a variable or function

If you are looking for a symbol, use the Tags commands (see the node
"Tags" in the manual for more details), they are much more efficient
than searching all buffers.

> but it could be the regex
> 'sub [a-z_]+foo[a-z_]+' in a Perl file, or a the string 'cf.' that
> I remember using in a comment, or some nifty idiom that matches
> 'select (.*\]', etc.

For these, I highly recommend to install GNU Id-utils (if you don't
have them already on your system), and use the "M-x gid" interface
command.  The search using Id-utils is lightning-fast, much faster
than searching all the buffers with Emacs built-in search commands,
and supports regular expressions and substrings in a
language-sensitive way (i.e. it knows about the syntax of C/C++, for
example).

Bottom line: if you need to search files, use commands that search
files, they are highly optimized and much better suited for the task

> (I remember using etags years ago, but found it extremely cumbersome,
> and useful only in a fraction of the situations for which I needed
> this type of global search.)

What was cumbersome? perhaps you didn't know about some useful command
or feature related to tags.  How about if you try again and see if
there are any problems that bother you?




reply via email to

[Prev in Thread] Current Thread [Next in Thread]