emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] Re: Using babel to generate a commit log


From: Eric Schulte
Subject: Re: [O] Re: Using babel to generate a commit log
Date: Wed, 30 Mar 2011 17:44:46 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

Luke Crook <address@hidden> writes:

> Luke Crook <luke <at> balooga.com> writes:
>
>> 
>> Eric Schulte <schulte.eric <at> 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



reply via email to

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