From mboxrd@z Thu Jan 1 00:00:00 1970 From: KDr2 Subject: #+INCLUDE: file in code block results does not work? Date: Wed, 26 Mar 2014 15:48:59 +0800 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a1134aa02c74b0904f57db423 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:48236) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WSiaR-0006I7-SJ for emacs-orgmode@gnu.org; Wed, 26 Mar 2014 03:49:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WSiaO-0006XA-ME for emacs-orgmode@gnu.org; Wed, 26 Mar 2014 03:49:23 -0400 Received: from mail-oa0-x229.google.com ([2607:f8b0:4003:c02::229]:49310) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WSiaO-0006X4-Gc for emacs-orgmode@gnu.org; Wed, 26 Mar 2014 03:49:20 -0400 Received: by mail-oa0-f41.google.com with SMTP id j17so2087654oag.0 for ; Wed, 26 Mar 2014 00:49:19 -0700 (PDT) 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 To: emacs-orgmode@gnu.org --001a1134aa02c74b0904f57db423 Content-Type: text/plain; charset=ISO-8859-1 I wrote a piece of code like below: #+NAME: inc-file #+BEGIN_SRC elisp :results value raw :exports results :var file=" common.inc.org" (concat "#+INCLUDE: /path/to/include-dir/" file) ;; path is cal-ed from path of current-buffer file #+END_SRC #+CALL: inc-file(file="a.org") :results raw but this does not work, anyone knows why? By the way, #+HTML_HEAD in code block results works well: #+NAME: d-header #+BEGIN_SRC elisp :results value raw :exports results (concat "#+HTML_HEAD: ") #+END_SRC #+CALL: d-header() :results raw Thanks. -- -- KDr2, http://kdr2.com --001a1134aa02c74b0904f57db423 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable --001a1134aa02c74b0904f57db423-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: #+INCLUDE: file in code block results does not work? Date: Wed, 26 Mar 2014 10:35:14 +0100 Message-ID: <87wqfhuwtp.fsf@gmail.com> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:43890) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WSkEU-0001e3-HA for emacs-orgmode@gnu.org; Wed, 26 Mar 2014 05:34:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WSkEQ-0004i6-3B for emacs-orgmode@gnu.org; Wed, 26 Mar 2014 05:34:50 -0400 Received: from mail-wg0-x232.google.com ([2a00:1450:400c:c00::232]:58101) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WSkEP-0004ht-S8 for emacs-orgmode@gnu.org; Wed, 26 Mar 2014 05:34:46 -0400 Received: by mail-wg0-f50.google.com with SMTP id x13so1088806wgg.21 for ; Wed, 26 Mar 2014 02:34:44 -0700 (PDT) In-Reply-To: (KDr2's message of "Wed, 26 Mar 2014 15:48:59 +0800") 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 To: KDr2 Cc: emacs-orgmode@gnu.org Hello, KDr2 writes: > I wrote a piece of code like below: > > #+NAME: inc-file > #+BEGIN_SRC elisp :results value raw :exports results :var file=" > common.inc.org" > (concat "#+INCLUDE: /path/to/include-dir/" file) ;; path is cal-ed from > path of current-buffer file > #+END_SRC > > #+CALL: inc-file(file="a.org") :results raw > > but this does not work, anyone knows why? During export process, INCLUDE keywords are expanded before Babel code is executed. You can use a macro here: #+MACRO: inc-file #+INCLUDE: /path/to-include-dir/$1 {{{inc-file(a.org)}}} Regards, -- Nicolas Goaziou From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: #+INCLUDE: file in code block results does not work? Date: Wed, 26 Mar 2014 10:42:03 +0100 Message-ID: <87siq5uwic.fsf@gmail.com> References: <87wqfhuwtp.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:48037) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WSkLA-0004wC-4d for emacs-orgmode@gnu.org; Wed, 26 Mar 2014 05:41:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WSkL1-00006n-Mu for emacs-orgmode@gnu.org; Wed, 26 Mar 2014 05:41:44 -0400 Received: from mail-wi0-x234.google.com ([2a00:1450:400c:c05::234]:45048) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WSkL1-00006B-57 for emacs-orgmode@gnu.org; Wed, 26 Mar 2014 05:41:35 -0400 Received: by mail-wi0-f180.google.com with SMTP id hr14so1643939wib.1 for ; Wed, 26 Mar 2014 02:41:34 -0700 (PDT) In-Reply-To: <87wqfhuwtp.fsf@gmail.com> (Nicolas Goaziou's message of "Wed, 26 Mar 2014 10:35:14 +0100") 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 To: KDr2 Cc: emacs-orgmode@gnu.org Nicolas Goaziou writes: > You can use a macro here: > > #+MACRO: inc-file #+INCLUDE: /path/to-include-dir/$1 > > {{{inc-file(a.org)}}} Err, no. Macros are also expanded after INCLUDE keywords. The only code executed before these are handled is `org-export-before-processing-hook'. 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 19:54:25 +0800 Message-ID: References: <87wqfhuwtp.fsf@gmail.com> <87siq5uwic.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=089e01160dca806dec04f58122c9 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:47139) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WSmPv-0003uF-5T for emacs-orgmode@gnu.org; Wed, 26 Mar 2014 07:54:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WSmPu-0008NC-6K for emacs-orgmode@gnu.org; Wed, 26 Mar 2014 07:54:47 -0400 Received: from mail-oa0-x229.google.com ([2607:f8b0:4003:c02::229]:50591) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WSmPu-0008N7-16 for emacs-orgmode@gnu.org; Wed, 26 Mar 2014 07:54:46 -0400 Received: by mail-oa0-f41.google.com with SMTP id j17so2357463oag.14 for ; Wed, 26 Mar 2014 04:54:45 -0700 (PDT) In-Reply-To: <87siq5uwic.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 To: Nicolas Goaziou Cc: emacs-orgmode@gnu.org --089e01160dca806dec04f58122c9 Content-Type: text/plain; charset=ISO-8859-1 Thanks very much. I use dynamic block now, by adding `org-update-all-dblocks' to `org-export-before-processing-hook'. On Wed, Mar 26, 2014 at 5:42 PM, Nicolas Goaziou wrote: > Nicolas Goaziou writes: > > > You can use a macro here: > > > > #+MACRO: inc-file #+INCLUDE: /path/to-include-dir/$1 > > > > {{{inc-file(a.org)}}} > > Err, no. Macros are also expanded after INCLUDE keywords. The only code > executed before these are handled is > `org-export-before-processing-hook'. > -- -- KDr2, http://kdr2.com --089e01160dca806dec04f58122c9 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Thanks very much.

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


On Wed,= Mar 26, 2014 at 5:42 PM, Nicolas Goaziou <n.goaziou@gmail.com> wrote:
Nicolas Goaziou <n.goaziou@gmail.com> writes:

> You can use a macro here:
>
> =A0 #+MACRO: inc-file #+INCLUDE: /path/to-include-dir/$1
>
> =A0 {{{inc-file(a.org)}= }}

Err, no. Macros are also expanded after INCLUDE keywords. The only co= de
executed before these are handled is
`org-export-before-processing-hook'.



--
--=A0

KDr2, http://kdr2.com
--089e01160dca806dec04f58122c9-- 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:04:44 +0800 Message-ID: References: <87wqfhuwtp.fsf@gmail.com> <87siq5uwic.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7b33d67c959cd504f582f470 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:51653) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WSoS3-0004nY-0o for emacs-orgmode@gnu.org; Wed, 26 Mar 2014 10:05:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WSoS1-0002lz-K4 for emacs-orgmode@gnu.org; Wed, 26 Mar 2014 10:05:06 -0400 Received: from mail-ob0-x22c.google.com ([2607:f8b0:4003:c01::22c]:58922) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WSoS1-0002kk-G1 for emacs-orgmode@gnu.org; Wed, 26 Mar 2014 10:05:05 -0400 Received: by mail-ob0-f172.google.com with SMTP id wm4so2521402obc.3 for ; Wed, 26 Mar 2014 07:05:04 -0700 (PDT) In-Reply-To: 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 To: Nicolas Goaziou Cc: emacs-orgmode@gnu.org --047d7b33d67c959cd504f582f470 Content-Type: text/plain; charset=ISO-8859-1 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 On Wed, Mar 26, 2014 at 7:54 PM, KDr2 wrote: > Thanks very much. > > I use dynamic block now, by adding `org-update-all-dblocks' to > `org-export-before-processing-hook'. > > > On Wed, Mar 26, 2014 at 5:42 PM, Nicolas Goaziou wrote: > >> Nicolas Goaziou writes: >> >> > You can use a macro here: >> > >> > #+MACRO: inc-file #+INCLUDE: /path/to-include-dir/$1 >> > >> > {{{inc-file(a.org)}}} >> >> Err, no. Macros are also expanded after INCLUDE keywords. The only code >> executed before these are handled is >> `org-export-before-processing-hook'. >> > > > > -- > -- > > KDr2, http://kdr2.com > -- -- KDr2, http://kdr2.com --047d7b33d67c959cd504f582f470 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
I wrote a blog entry to describe all the dynamic tricks I = used in the exporting:



O= n Wed, Mar 26, 2014 at 7:54 PM, KDr2 <killy.draw@gmail.com> wrote:
Thanks very much.

<= /div>
I use dynamic block now, by adding `org-update-all-dblocks' t= o=A0`org-export= -before-processing-hook'.


On Wed, Mar 26, 2014 at 5:42 PM, Nicolas Goaziou <n.goa= ziou@gmail.com> wrote:
Nicolas Goaziou <n.goaziou@gmail.com> writes:
> You can use a macro here:
>
> =A0 #+MACRO: inc-file #+INCLUDE: /path/to-include-dir/$1
>
> =A0 {{{inc-file(a.org)}= }}

Err, no. Macros are also expanded after INCLUDE keywords. The only co= de
executed before these are handled is
`org-export-before-processing-hook'.



--
--=A0



--
--=A0

KDr2, http://kdr2.com
--047d7b33d67c959cd504f582f470-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: #+INCLUDE: file in code block results does not work? Date: Wed, 26 Mar 2014 15:31:11 +0100 Message-ID: <878urxuj4g.fsf@gmail.com> References: <87wqfhuwtp.fsf@gmail.com> <87siq5uwic.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:56547) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WSoqx-0001K3-7m for emacs-orgmode@gnu.org; Wed, 26 Mar 2014 10:30:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WSoqp-0002Nb-Vm for emacs-orgmode@gnu.org; Wed, 26 Mar 2014 10:30:51 -0400 Received: from mail-we0-x233.google.com ([2a00:1450:400c:c03::233]:35628) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WSoqp-0002NQ-7j for emacs-orgmode@gnu.org; Wed, 26 Mar 2014 10:30:43 -0400 Received: by mail-we0-f179.google.com with SMTP id x48so1165369wes.24 for ; Wed, 26 Mar 2014 07:30:42 -0700 (PDT) In-Reply-To: (KDr2's message of "Wed, 26 Mar 2014 22:04:44 +0800") 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 To: KDr2 Cc: emacs-orgmode@gnu.org 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 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--