From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: Re: Using babel to generate a commit log Date: Wed, 30 Mar 2011 14:42:13 -0400 Message-ID: <6089.1301510533@alphaville.usa.hp.com> References: <814o6l9l9e.fsf@gmail.com> <8526.1301492596@alphaville.dokosmarshall.org> Reply-To: nicholas.dokos@hp.com Return-path: Received: from [140.186.70.92] (port=50671 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q50LT-0002eq-BM for emacs-orgmode@gnu.org; Wed, 30 Mar 2011 14:42:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q50LS-0002M9-1z for emacs-orgmode@gnu.org; Wed, 30 Mar 2011 14:42:19 -0400 Received: from g4t0016.houston.hp.com ([15.201.24.19]:12186) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q50LR-0002Lt-O2 for emacs-orgmode@gnu.org; Wed, 30 Mar 2011 14:42:17 -0400 In-Reply-To: Message from Luke Crook of "Wed, 30 Mar 2011 18:08:10 -0000." List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Luke Crook Cc: nicholas.dokos@hp.com, emacs-orgmode@gnu.org Luke Crook wrote: > Nick Dokos hp.com> writes: > > > > > Luke Crook balooga.com> wrote: > > > > > Jambunathan K 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