From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: Using babel to generate a commit log Date: Wed, 30 Mar 2011 02:29:24 -0400 Message-ID: <5684.1301466564@alphaville.dokosmarshall.org> References: Reply-To: nicholas.dokos@hp.com Return-path: Received: from [140.186.70.92] (port=36926 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q4ouR-0004r5-Bp for emacs-orgmode@gnu.org; Wed, 30 Mar 2011 02:29:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q4ouQ-0000er-HP for emacs-orgmode@gnu.org; Wed, 30 Mar 2011 02:29:39 -0400 Received: from vms173001pub.verizon.net ([206.46.173.1]:47720) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q4ouQ-0000eC-E2 for emacs-orgmode@gnu.org; Wed, 30 Mar 2011 02:29:38 -0400 Received: from alphaville.dokosmarshall.org ([unknown] [173.76.32.106]) by vms173001.mailsrvcs.net (Sun Java(tm) System Messaging Server 7u2-7.02 32bit (built Apr 16 2009)) with ESMTPA id <0LIU002QSY11YJ00@vms173001.mailsrvcs.net> for emacs-orgmode@gnu.org; Wed, 30 Mar 2011 01:29:25 -0500 (CDT) In-reply-to: Message from Luke Crook of "Wed, 30 Mar 2011 05:38:41 -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: > > I have written the following code that uses the Emacs vc-* commands to generate > a commit log. I would like the output of this code to be included when my file > is exported. > > > ;; Most of this code is copied from vc.el vc-print-log > (when (vc-find-backend-function (vc-backend (buffer-file-name (current-buffer))) > 'print-log) > (let* ((limit (if (numberp limit) limit vc-log-show-limit)) > (vc-fileset (vc-deduce-fileset t)) ;FIXME: Why t? --Stef > (backend (car vc-fileset)) > (files (cadr vc-fileset))) > (with-temp-buffer > (vc-call-backend backend > 'print-log > files > (current-buffer)) > (sit-for 5 t) > (buffer-string)))) > #+end_src > > What is happening is; > > 1) The code between #+begin_src and #+end_src is exported and not the result > of evaluating the code (the commit log). Try using --8<---------------cut here---------------start------------->8--- #+begin_src emacs-lisp :var limit="" :exports results --8<---------------cut here---------------end--------------->8--- > 2) I have to add at delay of at least 5 seconds (set-for 5 t) as vc-git calls > "git log" as an asynchronous process. If not for the delay then babel > immediately returns an empty buffer and the "vc-call-backend" process never > completes. > A quick look didn't produce much enlightenment: the standard way is to set a process sentinel, but this is commented out in vc-do-command. There is also a hook that is run at the end of the function: ,---- | (vc-exec-after | `(run-hook-with-args 'vc-post-command-functions | ',command ',file-or-list ',flags)) `---- but I think you need the process in order to set a sentinel (see sec. 37.10 of the Elisp manual for info on sentinels). Nick