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

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

Re: Why I get different results running the same exp?


From: Barry Margolin
Subject: Re: Why I get different results running the same exp?
Date: Sat, 09 Jun 2007 00:08:51 -0400
User-agent: MT-NewsWatcher/3.5.2 (PPC Mac OS X)

In article <mailman.1761.1181271448.32220.help-gnu-emacs@gnu.org>,
 "Yu,Gang" <wuhanyugang@gmail.com> wrote:

> If I understand you corrently, I restart emacs with
> 
> "emacs -q"
> 
> I copy the code to *scratch*, evaluate them
> 
> then, I repeatedly run "(ygrep "(start|stop)-process" "\\.el$" load-path)"
> third times,
> 
> first result is 128 matches , and second 141, third 146.

Works fine for me, I get 172 matches every time.

> 
> I ediff the buffers ,find that some items are ingored by the precedent
> match.
> 
> But I could not explain:-(
> 
> I suspect the problem is
> "(while (and
>         grep-process
>         (not (equal (process-status grep-process) 'exit)))
>       (sleep-for 0 100)))"
> 
> but I am not sure, any suggestions?

That's just waiting for the grep to finish, which is fine.

I'm not sure why your function is so complicated.  Instead of doing a 
separate grep for each directory and then combining them, why don't you 
do one big grep for everything?  Append "/*.el" to each element of the 
directory, concatenate them, and pass them to grep.  E.g. if load-path 
contains ("/path/to/dir1" "/path/to/dir2") you do

(let* ((paths (mapconcat '(lambda (dir) (concat dir "/*.el"))
                         load-path))
       (command (sprintf "egrep -nH -e '%s' %s" regexp paths)))
  (grep command))

> 
> thanks
> 
> On 6/7/07, Thien-Thi Nguyen <ttn@gnuvola.org> wrote:
> >
> > () "Yu,Gang" <wuhanyugang@gmail.com>
> > () Thu, 7 Jun 2007 19:25:28 +0800
> >
> >    but, everytime I run:
> >
> >    (ygrep "(start|stop)-process" "\\.el$" load-path)
> >
> >    in the *scratch* buffer, I get a different result.
> >
> >    What's wrong??
> >
> > if you save the code and repeatedly load it into a freshly
> > started emacs, do you get consistent results each time?
> >
> > if so, what does that mean?
> > if not, what does that mean?
> >
> > thi
> > _______________________________________________
> > help-gnu-emacs mailing list
> > help-gnu-emacs@gnu.org
> > http://lists.gnu.org/mailman/listinfo/help-gnu-emacs
> >
> 
> cheers

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***


reply via email to

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