From mboxrd@z Thu Jan 1 00:00:00 1970 From: KDr2 Subject: Re: #+INCLUDE: file in code block results does not work? Date: Wed, 26 Mar 2014 22:38:36 +0800 Message-ID: References: <87wqfhuwtp.fsf@gmail.com> <87siq5uwic.fsf@gmail.com> <878urxuj4g.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=089e01176183b1c5c404f5836d2f Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:58063) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WSoyo-00037b-Jo for emacs-orgmode@gnu.org; Wed, 26 Mar 2014 10:38:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WSoyn-0004vx-EP for emacs-orgmode@gnu.org; Wed, 26 Mar 2014 10:38:58 -0400 Received: from mail-ob0-x22d.google.com ([2607:f8b0:4003:c01::22d]:48061) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WSoyn-0004vn-9T for emacs-orgmode@gnu.org; Wed, 26 Mar 2014 10:38:57 -0400 Received: by mail-ob0-f173.google.com with SMTP id gq1so2595699obb.4 for ; Wed, 26 Mar 2014 07:38:56 -0700 (PDT) In-Reply-To: <878urxuj4g.fsf@gmail.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Cc: emacs-orgmode@gnu.org --089e01176183b1c5c404f5836d2f Content-Type: text/plain; charset=ISO-8859-1 Oh, I'll star this mail, and add it to my post later, thanks again :) On Wed, Mar 26, 2014 at 10:31 PM, Nicolas Goaziou wrote: > Hello, > > KDr2 writes: > > > I wrote a blog entry to describe all the dynamic tricks I used in the > > exporting: > > > > http://kdr2.com/tech/emacs/orgmode-export-process.html > > Thank you for sharing. > > For completeness, there is another step involved in the process before > switching to back-ends: run functions in > `org-export-before-parsing-hook'. > > >> I use dynamic block now, by adding `org-update-all-dblocks' to > >> `org-export-before-processing-hook'. > > Also, you can also a function in the same hook that would update > a generic "inc-file" macro in the file: > > (lambda (backend) > (org-with-wide-buffer > (goto-char (point-min)) > (let ((case-fold-search nil)) > (while (re-search-forward "^ *#\\+MACRO: +inc-file +\"\\(PATH\\)" > nil t) > (replace-match (get-path-dynamically) t nil nil 1))))) > > with the following generic macro: > > #+MACRO: inc-file "PATH$1" > > > Regards, > > -- > Nicolas Goaziou > -- -- KDr2, http://kdr2.com --089e01176183b1c5c404f5836d2f Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Oh, I'll star this mail, and add it to my post later, = thanks again :)


On Wed, Mar 26, 2014 at 10:31 PM, Nicolas Goaziou <n.goaziou@gma= il.com> wrote:
Hello,

KDr2 <killy.draw@gmail.com&g= t; writes:

> I wrote a blog entry to describe all the dynamic tricks I used in the<= br> > exporting:
>
> http://kdr2.com/tech/emacs/orgmode-export-process.html
Thank you for sharing.

For completeness, there is another step involved in the process before
switching to back-ends: run functions in
`org-export-before-parsing-hook'.

>> I use dynamic block now, by adding `org-update-all-dblocks' to=
>> `org-export-before-processing-hook'.

Also, you can also a function in the same hook that would update
a generic "inc-file" macro in the file:

=A0 (lambda (backend)
=A0 =A0 (org-with-wide-buffer
=A0 =A0 =A0(goto-char (point-min))
=A0 =A0 =A0(let ((case-fold-search nil))
=A0 =A0 =A0 =A0(while (re-search-forward "^ *#\\+MACRO: +inc-file +\&q= uot;\\(PATH\\)" nil t)
=A0 =A0 =A0 =A0 =A0(replace-match (get-path-dynamically) t nil nil 1)))))
with the following generic macro:

=A0 #+MACRO: inc-file "PATH$1"


Regards,

--
Nicolas Goaziou



--
--=A0
--089e01176183b1c5c404f5836d2f--