[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Re: Using babel to generate a commit log
From: |
Nick Dokos |
Subject: |
Re: [O] Re: Using babel to generate a commit log |
Date: |
Wed, 30 Mar 2011 14:42:13 -0400 |
Luke Crook <address@hidden> wrote:
> Nick Dokos <nicholas.dokos <at> hp.com> writes:
>
> >
> > Luke Crook <luke <at> balooga.com> wrote:
> >
> > > Jambunathan K <kjambunathan <at> gmail.com> writes:
> > >
> > > >
> > >
> > > I changed my code to wait until the 'Git' process completes. Luckily "vc-
> call-
> > > backend" returns the async process.
> > >
> >
> > ... or you could use a sentinel
> >
> > One bit of defensive programming might be to check that status *is* a
> > process before you do the wait: vc-do-command returns a real status in
> > the synchronous case, so if you cut-n-paste this code with some other
> > command that does not use async, it'll blow up.
> >
>
> I have modified the code to only check the status if the process is actually
> running;
>
> (with-temp-buffer
> (let ((status (vc-call-backend backend
> 'print-log
> files
> (current-buffer))))
> (when (= 0 (process-exit-status status))
> (while (not (eq 'exit (process-status status)))
> (sit-for 1 t)))
>
I meant something like this:
(if (processp status)
...do the process stuff)
It's not a problem here since vc-call-backend will always call print-log
asynchronously, so status will always be a process, but if you use this
code somewhere else with a different command that is *not* done
asynchronously, then you'll have a problem. Not a biggie.
> I'm not sure about using a sentinel though as this is just a callback that is
> executed when the process completes. Wouldn't the sentinel fire after the
> source
> block has returned?
>
> Or do you mean to wait until a variable set by the sentinel returns t?
>
Something like the latter: just something to avoid the busy-wait loop,
but again it's a minor nit - the loop works just fine.
Nick
Re: [O] Using babel to generate a commit log, Suvayu Ali, 2011/03/30
- [O] Re: Using babel to generate a commit log, Luke Crook, 2011/03/30
- Re: [O] Re: Using babel to generate a commit log, Nick Dokos, 2011/03/30
- [O] Re: Using babel to generate a commit log, Luke Crook, 2011/03/30
- Re: [O] Re: Using babel to generate a commit log, Nick Dokos, 2011/03/30
- [O] Re: Using babel to generate a commit log, Luke Crook, 2011/03/30
- [O] Re: Using babel to generate a commit log, Luke Crook, 2011/03/30
- Re: [O] Re: Using babel to generate a commit log, Eric Schulte, 2011/03/30
- Re: [O] Re: Using babel to generate a commit log, Nick Dokos, 2011/03/30
- [O] Re: Using babel to generate a commit log, Luke Crook, 2011/03/30