Hi. I want to include a note in several pages, therefore I created a #+MACRO for it. The macro must say „This file is best viewed when you open file {{{input-file}}} in org-mode (Emacs).“, where {{{input-file}}} would be expanded to the name of the file being expanded. Then I noticed that macros can't expand to other macros. This means:
#+MACRO: uno 1 #+MACRO: one {{{uno}}} {{{uno}}} works (1) but {{{one}}} should also be 1, not {{…uno}}} I attach a patch [1] which adds support for macros which expand to other macros, so the previous examples would work. It would of course get locked if you wanted macros like #+MACRO: recu {{{recu}}}, but that's apparently the intended behaviour :-) It will even work for macros that create parts of other macros. #+MACRO: cc1 100001 #+MACRO: cc2 100002 #+MACRO: mycc-start {{{cc #+MACRO: mycc-end 2}}} Yes, it is {{{mycc-start}}}{{{mycc-end}}}. And even: #+MACRO: mycc {{{mycc-start}}}{{{mycc-end}}} {{{mycc}}}. (100002 in both cases). If this is too complex, this partial macro writing can be disallowed by changing the (beginning-of-line) to a (goto-char (match-beginning 0)). -- Daniel [1] diff --git a/lisp/org-exp.el b/lisp/org-exp.el index 3e12e6a..3d2fad8 100644 --- a/lisp/org-exp.el +++ b/lisp/org-exp.el @@ -2106,7 +2106,7 @@ TYPE must be a string, any of: (if (and val (not (stringp val))) (setq val (format "%s" val)))) (and (stringp val) - (replace-match val t t)))))) + (prog1 (replace-match val t t) (beginning-of-line))))))) (defun org-export-apply-macros-in-string (s) "Apply the macros in string S." _______________________________________________ Emacs-orgmode mailing list Remember: use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode