emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] Using babel to generate a commit log


From: Luke Crook
Subject: [O] Using babel to generate a commit log
Date: Wed, 30 Mar 2011 05:38:41 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]