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

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

Re: Elisp: Search a File Without Visiting?


From: taashlo
Subject: Re: Elisp: Search a File Without Visiting?
Date: 16 Jun 2003 13:47:17 -0600
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

address@hidden (Kai Gro├čjohann) writes:
> address@hidden writes:
> > This currently works, but it relies on loading the entire thesaurus
> > file into a buffer to search for the word.  The problem is that the
> > thesaurus file (mthesaur.txt[1]) is about 24MiB.
> >
> > My question: is it possible (using elisp) to search the contents of
> > the thesaurus file *without* loading it into a buffer?
> 
> I can think of two ways to do it.  The first way is to write a
> program which does the searching (or use grep) and to have Emacs
> invoke that.  The second way is to repeatedly call
> insert-file-contents with the right BEG and END arguments to insert
> parts of the file into a buffer.
> 
> While using an external program makes sense, the other approach is
> not useful IMHO.  Emacs is really well optimized for working with
> buffers, so why not go with the flow and do it the way it's easiest
> in Emacs, why not do it the Emacs way?
> 
> -- 
> This line is not blank.

Thank you Kai!  This is exactly the kind of idea I needed.  I think
that I can use grep to do the searching and return the results for my
elisp to massage for displaying.  My initial tests with grep show
that it will not only use *much* less memory, but it is also *much*
faster.

Thanks again,
Tad


reply via email to

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