emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nick Dokos <nicholas.dokos@hp.com>
To: Luke Crook <luke@balooga.com>
Cc: nicholas.dokos@hp.com, emacs-orgmode@gnu.org
Subject: Re: Re: Using babel to generate a commit log
Date: Wed, 30 Mar 2011 14:42:13 -0400	[thread overview]
Message-ID: <6089.1301510533@alphaville.usa.hp.com> (raw)
In-Reply-To: Message from Luke Crook <luke@balooga.com> of "Wed, 30 Mar 2011 18:08:10 -0000." <loom.20110330T200407-744@post.gmane.org>

Luke Crook <luke@balooga.com> 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

  reply	other threads:[~2011-03-30 18:42 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-30  5:38 Using babel to generate a commit log Luke Crook
2011-03-30  6:26 ` Jambunathan K
2011-03-30  7:57   ` Luke Crook
2011-03-30 13:43     ` Nick Dokos
2011-03-30 18:08       ` Luke Crook
2011-03-30 18:42         ` Nick Dokos [this message]
2011-03-30  6:28 ` Suvayu Ali
2011-03-30  7:52   ` Luke Crook
2011-03-30 13:07     ` Nick Dokos
2011-03-30 15:34       ` Luke Crook
2011-03-30 16:51         ` Nick Dokos
2011-03-30 17:47           ` Luke Crook
2011-03-30 18:41             ` Luke Crook
2011-03-30 20:10             ` Eric Schulte
2011-03-30 20:22               ` Nick Dokos
2011-03-30 22:02               ` Luke Crook
2011-03-30 23:20                 ` Luke Crook
2011-03-30 23:44                   ` Eric Schulte
2011-03-31  6:49                     ` Luke Crook
2011-04-01  0:28                       ` Eric Schulte
2011-03-30  6:29 ` Nick Dokos
2011-03-30 20:12 ` Eric Schulte
2011-03-30 21:58   ` Luke Crook

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.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6089.1301510533@alphaville.usa.hp.com \
    --to=nicholas.dokos@hp.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=luke@balooga.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

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).