From mboxrd@z Thu Jan 1 00:00:00 1970 From: Luke Crook Subject: Re: Using babel to generate a commit log Date: Wed, 30 Mar 2011 23:20:16 +0000 (UTC) Message-ID: References: <20110329232804.45777e7a@bhishma.homelinux.net> <8080.1301490442@alphaville.dokosmarshall.org> <5188.1301503865@alphaville.usa.hp.com> <87d3l8s6qd.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Return-path: Received: from [140.186.70.92] (port=41737 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q54gh-00044W-Fs for emacs-orgmode@gnu.org; Wed, 30 Mar 2011 19:20:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q54gf-0002ag-Lk for emacs-orgmode@gnu.org; Wed, 30 Mar 2011 19:20:31 -0400 Received: from lo.gmane.org ([80.91.229.12]:53523) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q54gf-0002aO-Fu for emacs-orgmode@gnu.org; Wed, 30 Mar 2011 19:20:29 -0400 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1Q54gd-0006tn-Gz for emacs-orgmode@gnu.org; Thu, 31 Mar 2011 01:20:27 +0200 Received: from 147.21.8.1 ([147.21.8.1]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 31 Mar 2011 01:20:27 +0200 Received: from luke by 147.21.8.1 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 31 Mar 2011 01:20:27 +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 Luke Crook balooga.com> writes: > > Eric Schulte gmail.com> writes: > > > #+begin_src emacs-lisp :var buf=(buffer-file-name (current-buffer)) :exports > both > > (message "buffer %S!" buf) > > #+end_src > > The following code will now generate the commit log. #+begin_src emacs-lisp :var limit=-1 :var buf=(buffer-name (current-buffer)) :exports results ;; Most of this code is copied from vc.el vc-print-log (when (vc-find-backend-function (vc-backend (buffer-file-name (get-buffer buf))) 'print-log) (let ((limit -1) (vc-fileset nil) (backend nil) (files nil)) (with-current-buffer (get-buffer buf) (setq vc-fileset (vc-deduce-fileset t)) ;FIXME: Why t? --Stef (setq backend (car vc-fileset)) (setq files (cadr vc-fileset))) (with-temp-buffer (let ((status (vc-call-backend backend 'print-log files (current-buffer)))) (when (and (processp status) ;; Make sure status is a process (= 0 (process-exit-status status))) ;; And that it has not terminated (while (not (eq 'exit (process-status status))) ;; Loop and sleep until complete (sit-for 1 t))) (buffer-string))))) #+end_src