unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: taashlo@sandia.gov
Subject: Re: Elisp: Search a File Without Visiting?
Date: 16 Jun 2003 13:47:17 -0600	[thread overview]
Message-ID: <uisr5yfcq.fsf@sandia.gov> (raw)
In-Reply-To: 84wuflltt0.fsf@lucy.is.informatik.uni-duisburg.de

kai.grossjohann@gmx.net (Kai Großjohann) writes:
> taashlo@sandia.gov 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	other threads:[~2003-06-16 19:47 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-16 18:33 Elisp: Search a File Without Visiting? taashlo
2003-06-16 19:13 ` Sam Halliday
2003-06-16 19:48   ` taashlo
2003-06-16 19:13 ` Kai Großjohann
2003-06-16 19:47   ` taashlo [this message]
2003-06-16 19:20 ` Stefan Monnier
2003-06-17 17:04   ` taashlo
2003-06-17 18:19     ` Stefan Monnier
2003-06-18  0:44       ` Tad Ashlock
2003-06-17 15:02 ` Eric Hanchrow

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=uisr5yfcq.fsf@sandia.gov \
    --to=taashlo@sandia.gov \
    /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).