emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Using babel to generate a commit log
@ 2011-03-30  5:38 Luke Crook
  2011-03-30  6:26 ` Jambunathan K
                   ` (3 more replies)
  0 siblings, 4 replies; 23+ messages in thread
From: Luke Crook @ 2011-03-30  5:38 UTC (permalink / raw)
  To: emacs-orgmode


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

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2011-04-01  0:34 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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