From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: Name of file being exported. Date: Wed, 15 Apr 2009 07:02:39 +0200 Message-ID: <186518F1-01D4-4F1B-9EA2-978C2699AC1E@gmail.com> References: <49E3F37E.5090704@nibrahim.net.in> <5DBFB303-366D-4485-82B9-6CF0EFAC257C@gmail.com> <49E4A4A4.8050909@nibrahim.net.in> <16352.1239726014@gamaville.dokosmarshall.org> <49E4BC54.1060504@nibrahim.net.in> <17069.1239733610@gamaville.dokosmarshall.org> Mime-Version: 1.0 (Apple Message framework v930.3) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LtxGq-0003Mr-OQ for emacs-orgmode@gnu.org; Wed, 15 Apr 2009 01:02:48 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LtxGl-0003KA-Fc for emacs-orgmode@gnu.org; Wed, 15 Apr 2009 01:02:47 -0400 Received: from [199.232.76.173] (port=33007 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LtxGl-0003Jy-Cd for emacs-orgmode@gnu.org; Wed, 15 Apr 2009 01:02:43 -0400 Received: from mail-ew0-f160.google.com ([209.85.219.160]:44443) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LtxGk-0007rg-M6 for emacs-orgmode@gnu.org; Wed, 15 Apr 2009 01:02:42 -0400 Received: by ewy4 with SMTP id 4so3352514ewy.42 for ; Tue, 14 Apr 2009 22:02:41 -0700 (PDT) In-Reply-To: <17069.1239733610@gamaville.dokosmarshall.org> 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: nicholas.dokos@hp.com Cc: emacs-orgmode@gnu.org On Apr 14, 2009, at 8:26 PM, Nick Dokos wrote: > Noufal Ibrahim wrote: > >> Hi Nick, >> >> Nick Dokos wrote: >> [..] >>> >>> Can you run org-update-all-dblocks by hand before doing the export? >> >> That's possible. What I do now is to to add the >> org-update-all-dbblocks to write-file-hooks as suggested by the info >> pages. >> >> This works for me but there are times when I export directly without >> saving and I'd like the block to get updated then too. >> >>> If so, you can even automate the process by advising >>> org-export, so that org-update-all-dblocks is run before org-export >>> proper is called. [1] >> >> This sounds better. I shall try this. Although I'm wondering if there >> isn't a hook that I can add a function to manage what I want. >> > > Maybe this will work: the current buffer-file-name is saved in > org-export-as-html (and I assume in the other export routines) in a > dynamically scoped variable called org-current-export-file. The > value of > that variable should be available in the hook as well. So instead of > (buffer-file-name), you probably want to say > > (or (buffer-file-name) org-current-export-file) > > That way, your updater can be called both from inside and outside > the export functions. Great solution. We could also introduce a new hook which is run before export. However, for the functionality discussed here, I think that before-save-hook would be a very good place too. - Carsten > > HTH, > Nick >