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