From: Jambunathan K <kjambunathan@gmail.com>
To: Luke Crook <luke@balooga.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Using babel to generate a commit log
Date: Wed, 30 Mar 2011 11:56:37 +0530 [thread overview]
Message-ID: <814o6l9l9e.fsf@gmail.com> (raw)
In-Reply-To: <loom.20110330T000117-818@post.gmane.org> (Luke Crook's message of "Wed, 30 Mar 2011 05:38:41 +0000 (UTC)")
Luke Crook <luke@balooga.com> writes:
> 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) ?
Quick hints if you are willing to settle for some hacks.
In vc-do-command, you may have to set OKSTATUS to 0. Track
`vc-disable-async-diff' in vc.el and vc-svn.el for possible hints.
,----[ C-h f vc-do-command RET ]
| vc-do-command is an autoloaded Lisp function in `vc-dispatcher.el'.
|
| (vc-do-command BUFFER OKSTATUS COMMAND FILE-OR-LIST &rest FLAGS)
|
| Execute a slave command, notifying user and checking for errors.
| Output from COMMAND goes to BUFFER, or the current buffer if
| BUFFER is t. If the destination buffer is not already current,
| set it up properly and erase it. The command is considered
| successful if its exit status does not exceed OKSTATUS (if
| OKSTATUS is nil, that means to ignore error status, if it is
| `async', that means not to wait for termination of the
| subprocess; if it is t it means to ignore all execution errors).
| FILE-OR-LIST is the name of a working file; it may be a list of
| files or be nil (to execute commands that don't expect a file
| name or set of files). If an optional list of FLAGS is present,
| that is inserted into the command line before the filename.
| Return the return value of the slave command in the synchronous
| case, and the process object in the asynchronous case.
|
| [back]
`----
,----[ C-h v vc-disable-async-diff RET ]
| vc-disable-async-diff is a variable defined in `vc.el'.
| Its value is nil
|
| Documentation:
| VC sets this to t locally to disable some async diff operations.
| Backends that offer asynchronous diffs should respect this variable
| in their implementation of vc-BACKEND-diff.
|
| [back]
`----
>
> Thanks,
> -Luke
>
>
>
>
--
next prev parent reply other threads:[~2011-03-30 6:26 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-30 5:38 Using babel to generate a commit log Luke Crook
2011-03-30 6:26 ` Jambunathan K [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=814o6l9l9e.fsf@gmail.com \
--to=kjambunathan@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=luke@balooga.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).