From mboxrd@z Thu Jan 1 00:00:00 1970 From: Luke Crook Subject: Using babel to generate a commit log Date: Wed, 30 Mar 2011 05:38:41 +0000 (UTC) Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Return-path: Received: from [140.186.70.92] (port=60193 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q4o7O-0007OF-E3 for emacs-orgmode@gnu.org; Wed, 30 Mar 2011 01:38:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q4o7N-00018R-GE for emacs-orgmode@gnu.org; Wed, 30 Mar 2011 01:38:58 -0400 Received: from lo.gmane.org ([80.91.229.12]:50292) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q4o7N-000183-81 for emacs-orgmode@gnu.org; Wed, 30 Mar 2011 01:38:57 -0400 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1Q4o7L-0007Lp-5K for emacs-orgmode@gnu.org; Wed, 30 Mar 2011 07:38:55 +0200 Received: from pool-173-55-252-200.lsanca.fios.verizon.net ([173.55.252.200]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 30 Mar 2011 07:38:55 +0200 Received: from luke by pool-173-55-252-200.lsanca.fios.verizon.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 30 Mar 2011 07:38:55 +0200 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: emacs-orgmode@gnu.org 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. #+begin_src emacs-lisp :var limit="" ;; 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). 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. How can I fix (1). Is there a better way that I can accomplish (2) ? Thanks, -Luke