lines out of the code block. If I didn’t and tried to eval that block, I got the error,#+MACRO: SEC_FOO
On Wed, Nov 1, 2017 at 11:51 AM Kaushal Modi <kaushal.modi@gmail.com> wrote:I still don't have a fully working solution (see below). Hopefully someone can help figure out the reason for "Invalid read syntax: #" error.OK, I found a workaround. Below solution works:1. Eval the =org-macros= block once (=C-c C-c=)- Always use that =org-macros= block to define the Org macros for this file.- Hitting =C-c C-c= will insert those macros in this file.- This block is reused as a noweb-ref in other blocks.. so keeping just thisblock as a source for all Org macros will be convenient.2. Then export that file (=C-c C-e h o=)=====#+BEGIN_SRC org :noweb-ref org-macros :results output replace :exports none,#+MACRO: SEC_FOO Foo Topic,#+MACRO: SEC_BAR Bar Topic#+END_SRC#+NAME: ehdr#+BEGIN_SRC emacs-lisp :var macro="n" :noweb yes :results raw :exports none(with-temp-buffer(insert "<<org-macros>>\n")(let ((start (point)))(insert "// ---------------------------\n")(insert (concat "// {{{" macro "}}}"))(org-mode)(org-macro-replace-all(append org-macro-templates org-export-global-macros))(buffer-substring-no-properties start (point-max))))#+END_SRC* Section 1: {{{SEC_FOO}}}#+BEGIN_SRC verilog :noweb yes<<ehdr(macro="SEC_FOO")>>parameter A = 1;#+END_SRC* Section 2: {{{SEC_BAR}}}#+BEGIN_SRC verilog :noweb yes<<ehdr(macro="SEC_BAR")>>parameter A = 1;#+END_SRC=====--Kaushal Modi