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 14:10:51 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

Luke Crook <address@hidden> writes:

> Nick Dokos <nicholas.dokos <at> hp.com> writes:
>
>> 
>> Luke Crook <luke <at> balooga.com> wrote:
>> 
>> > 'C-c C-c' at the top of the source block does generate the correct output 
>> > though. It is just 'C-c C-e <export backend>' that returns this error.
>> > 
>> 
>> Right: (current-buffer) is not what you think it is when exporting - it is
>> the temp buffer that the export mechanism sets up.
>> 
>> There is a way to get the original buffer during capture, but I don't
>> know of a similar mechanism during export. I hardwired the file name
>> instead, but I got no further than the vc-fileset call: there seem to be
>> all sorts of contextual assumptions that vc makes that are violated in
>> the export context.
>
> Yes, this makes sense thanks. I'll create another thread asking how to 
> retrieve 
> the original buffer during the export process.
>

It is true that export takes place in a fresh Org-mode buffer, however
the header arguments of Org-mode code blocks are guaranteed to be
evaluated in the original buffer, so a trick like the following can be
used to grab the original buffer.

#+begin_src emacs-lisp :var buf=(buffer-file-name (current-buffer)) :exports 
both
  (message "buffer %S!" buf)
#+end_src

This issue should be given more prominence in the Org-mode manual, as it
is a common source of confusion.

Cheers -- Eric



reply via email to

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