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: kj
Subject: Re: How to search all open buffers?
Date: Tue, 4 Sep 2007 13:30:24 +0000 (UTC)
User-agent: nn/6.7.3

In <mailman.76.1188508709.18990.help-gnu-emacs@gnu.org> Eli Zaretskii 
<eliz@gnu.org> writes:

>> 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.

This is quite impractical.  As far as I can tell, 'A' searches all
the "specified files", so solving my problem with 'A' entails first
going back and forth between *Buffer List* and various Dired buffers,
and marking those files that are being visited.  (Marking the
enclosing directories is inadequate because, first, 'A' emits an
error when it is asked to search a directory, and second, the
directories contain many more files than those that are being
visited, which would not only slow down the search, but more
importantly, would generate many spurious hits contained in files
of no interest to me at the moment.)

>> 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.

I have used Tags before and I find it *extremely* inconvenient.

>> 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...

Yes, but it has the same problems as Tags: it requires the intermediate
step of creating an ids database.

What I'm missing is not search speed, but rather the convenience
of being able to search all the file-visiting buffers *right now*,
not after I fashion a suitable intermediate file...  Even a recursive
M-x grep is better than that, but it suffers from the same problem
of spurious hits mentioned earlier. 

>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?

Just imagine, for a second, having to go through the equivalent
rigmarole of creating a tags file just to search within a *single*
buffer; if such prospect seems supremely annoying to you then you'll
understand how I feel about making a tags file for searching multiple
buffers.

In all honesty, reading your reply made me only *more* puzzled at
this resistance to a built-in command to search all file-visiting
buffers.  Now I find it downright bizarre and mysterious.  Something
resembling a phobia or a religious taboo, and that simply cannot
be understood by outsiders...

kj


-- 
NOTE: In my address everything before the first period is backwards;
and the last period, and everything after it, should be discarded.


reply via email to

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