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 14:10:51 -0600 Message-ID: <87d3l8s6qd.fsf@gmail.com> References: <20110329232804.45777e7a@bhishma.homelinux.net> <8080.1301490442@alphaville.dokosmarshall.org> <5188.1301503865@alphaville.usa.hp.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from [140.186.70.92] (port=50323 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q51q3-0004A9-No for emacs-orgmode@gnu.org; Wed, 30 Mar 2011 16:18:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q51q1-0003so-Uc for emacs-orgmode@gnu.org; Wed, 30 Mar 2011 16:17:58 -0400 Received: from mail-iw0-f169.google.com ([209.85.214.169]:34084) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q51q1-0003sP-PY for emacs-orgmode@gnu.org; Wed, 30 Mar 2011 16:17:57 -0400 Received: by iwg8 with SMTP id 8so2128621iwg.0 for ; Wed, 30 Mar 2011 13:17:56 -0700 (PDT) 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: > Nick Dokos hp.com> writes: > >> >> Luke Crook 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 ' 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