>
> When I try to do (org-publish-current-project), I get an error that
> says “still-menu” macro is not defined but it is defined in base.org.
> The reason is (I guess) base.org includes other files and it is during
> processing of one of these files that the error occurs.

So the issue is trying to reference the macros defined in base.org from
files included by base.org? So base.org includes include.org and you
try reference base.org macros in include.org? I confirm I get the same
behaviour as you. No problem exporting, but publishing gives an error:

Publishing file /home/paul/tmp/myproject/include2.org using 
‘org-html-publish-to-html’
org-macro-replace-all: Undefined Org macro: mymacro; aborting

I guess that could be considered as a bug in publishing since it does work
when exporting. I'm not sure what the intended behaviour is for chaining
macros when including files though.

Here's my minimal working example:

(setq org-publish-project-alist
      '(("myproject"
        :base-directory "~/tmp/myproject/"
        :publishing-function org-html-publish-to-html
        :publishing-directory "~/tmp/myproject")))

test.org
---------------------------------------------------
#+MACRO: mymacro $1
#+INCLUDE: include.org

FILE: test.org

My macro is {{{mymacro(foo)}}}

My included macro is {{{myincludedmacro(bar)}}}

My included macro 2 is {{{myincludemacrotwo(baz)}}}
---------------------------------------------------

include.org
---------------------------------------------------
#+MACRO: myincludedmacro $1
#+INCLUDE: include2.org

FILE: include.org

# My macro is {{{mymacro(foo)}}}

My included macro is {{{myincludedmacro(bar)}}}

My included macro 2 is {{{myincludemacrotwo(baz)}}}
---------------------------------------------------

include2.org
---------------------------------------------------
#+MACRO: myincludemacrotwo $1

FILE: include2.org

# My macro is {{{mymacro(foo)}}}

# My included macro is {{{myincludedmacro(bar)}}}

My included macro 2 is {{{myincludemacrotwo(baz)}}}
---------------------------------------------------

Then while visiting test.org, run either C-c C-e h h to export html or
M-x org-publish-current-project

Exporting has no errors and produces the expected html whether the lines in
include.org or include2.org are commented or not.

Publishing has no errors and produces the expected html when the lines are
commented as above.

*However*, uncommenting any of the lines in include.org or include2.org gives
an error while publishing but/  For example, in include2.org uncommenting

# My macro is {{{mymacro(foo)}}}

gives the error

Publishing file /home/paul/tmp/myproject/include2.org using
‘org-html-publish-to-html’
org-macro-replace-all: Undefined Org macro: mymacro; aborting

Similarly for uncommenting the other line in include2.org or the line in
include.org.

Cheers,
Paul.

Reply via email to