From: Neel
Subject: Emacs lisp help
Date: 
Message-ID: <923666cb.0208150704.265da588@posting.google.com>
Hi:

I'm writing some emacs lisp function and would like to do the
following in the background. I have a list of files that I would like
to search for certain text. So, assuming I have the paths to these
files my function would need to:

1) go to the directory and file, open it. (So question is: How to I
"cd" to the dirctory and then open the file in the background)
2) then I would need to search it and return the text that I'm looking
for.

Any suggestions on how I could do this? 

Thanks in advance.

--Neel

From: Joel Ray Holveck
Subject: Re: Emacs lisp help
Date: 
Message-ID: <y7cvg6bd6ys.fsf@sindri.juniper.net>
> I'm writing some emacs lisp function and would like to do the
> following in the background. I have a list of files that I would like
> to search for certain text.

Have you looked at find-grep-dired or grep-find?

> 1) go to the directory and file, open it. (So question is: How to I
> "cd" to the dirctory and then open the file in the background)

I think you may want to look over the Emacs Lisp Intro
(ftp://ftp.gnu.org/gnu/emacs/emacs-lisp-intro-2.04.tar.gz)... The
basic function is find-file, and changing directories is not advised.
(It affects the directory of the buffer you happen to be in when it's
invoked, which is probably not what you want.)

> 2) then I would need to search it and return the text that I'm looking
> for.

Discussed in both the Lisp intro, and in the Emacs Lisp manual
(ftp://ftp.gnu.org/gnu/emacs/elisp-manual-21-2.8.tar.gz), in the
chapter on searching.

Cheers,
joelh
From: David Kastrup
Subject: Re: Emacs lisp help
Date: 
Message-ID: <x58z3887w6.fsf@tupik.goethe.zz>
··········@hotmail.com (Neel) writes:

> Hi:
> 
> I'm writing some emacs lisp function and would like to do the
> following in the background. I have a list of files that I would like
> to search for certain text. So, assuming I have the paths to these
> files my function would need to:
> 
> 1) go to the directory and file, open it. (So question is: How to I
> "cd" to the dirctory and then open the file in the background)
> 2) then I would need to search it and return the text that I'm looking
> for.
> 
> Any suggestions on how I could do this? 

What do you mean, "in background"?  Off-screen?  Or in a parallel
task/thread?  The latter is not possible in Emacs Lisp, unless you
let an external program handle the task.

Anyhow, have you taken a look at the M-x grep RET command?

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum
Email: ·············@t-online.de