emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Benny Simonsen <benny@slbs.dk>
To: emacs-orgmode@gnu.org
Subject: Macro expansion in included files
Date: Mon, 14 Mar 2011 23:01:55 +0100	[thread overview]
Message-ID: <AANLkTinvPbERdrzRrTGc311pyQR8CQB4ikFVsKNtEcup@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 942 bytes --]

Hi

Some time ago I was posting about a problem with macros in included
files - they will not expand.

Example with two files top.org and sub.org: macro in the included file
sub.org isn't expanded during export.
See the content of the example files below.

The patch fixes this so that the macro is expanded in both top.org and sub.org.

Setup:
org-mode: git master (head)
export top.org with org-export-as-html

I hope that the patch format is ok ("git diff" output) attached.

Best regards
Benny Simonsen

### top.org ############################################################
#+TITLE: Debug org file
#+MACRO: testmacro Expanded

{{{testmacro}}}

#+INCLUDE: "sub.org"
########################################################################

### sub.org ############################################################
#+TITLE: Included debug org file

{{{testmacro}}}
########################################################################

[-- Attachment #2: macro-expansion-in-included-files.patch --]
[-- Type: text/x-patch, Size: 565 bytes --]

diff --git a/lisp/org-exp.el b/lisp/org-exp.el
index 34f101d..d6b23a9 100644
--- a/lisp/org-exp.el
+++ b/lisp/org-exp.el
@@ -1083,6 +1083,10 @@ on this string to produce the exported version."
       ;; Call the hook
       (run-hooks 'org-export-preprocess-hook)
 
+      ;; Handle include files, and call a hook
+      (org-export-handle-include-files-recurse)
+      (run-hooks 'org-export-preprocess-after-include-files-hook)
+
       ;; Process the macros
       (org-export-preprocess-apply-macros)
       (run-hooks 'org-export-preprocess-after-macros-hook)

             reply	other threads:[~2011-03-14 22:01 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-14 22:01 Benny Simonsen [this message]
2011-04-08 10:36 ` Macro expansion in included files Carsten Dominik
  -- strict thread matches above, loose matches on Subject: below --
2011-03-01 21:59 Benny Simonsen
2011-03-02 16:26 ` Benny Simonsen
2011-03-03  9:10   ` Sébastien Vauban
2011-03-03 11:12     ` Benny Simonsen
2011-03-05  9:12   ` Benny Simonsen
2011-03-05 14:07     ` Sébastien Vauban
2011-03-05 17:55       ` Benny Simonsen
2011-06-30 16:29     ` Bastien
2011-08-30 17:22       ` Benny Simonsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AANLkTinvPbERdrzRrTGc311pyQR8CQB4ikFVsKNtEcup@mail.gmail.com \
    --to=benny@slbs.dk \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).