From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Eric Schulte" Subject: Re: Re: Using babel to generate a commit log Date: Wed, 30 Mar 2011 17:44:46 -0600 Message-ID: <8762r0rx5d.fsf@gmail.com> 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 Return-path: Received: from [140.186.70.92] (port=37133 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q554H-0007vO-Rn for emacs-orgmode@gnu.org; Wed, 30 Mar 2011 19:44:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q554G-00066P-F9 for emacs-orgmode@gnu.org; Wed, 30 Mar 2011 19:44:53 -0400 Received: from mail-iy0-f169.google.com ([209.85.210.169]:58697) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q554G-00066D-8R for emacs-orgmode@gnu.org; Wed, 30 Mar 2011 19:44:52 -0400 Received: by iyf13 with SMTP id 13so2329717iyf.0 for ; Wed, 30 Mar 2011 16:44:51 -0700 (PDT) In-Reply-To: (Luke Crook's message of "Wed, 30 Mar 2011 23:20:16 +0000 (UTC)") 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: Luke Crook Cc: emacs-orgmode@gnu.org Luke Crook writes: > 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 Great, Since this could be generally useful would you be willing to add it to the library of babel (org/contrib/babel/library-of-babel.org)? If so then if you could supply a few explanatory sentences, I'll add those and the code block to the library-of-babel.org distributed with Org-mode. Thanks -- Eric