The TITLE in this version comes out just “Supplement"

> #+OPTIONS: tags:nil
> #+SELECT_TAGS: R1 always
> 
> 
> #+NAME: model
> #+BEGIN_SRC elisp :exports none
>   (dolist (f (plist-get (org-export--get-inbuffer-options) :select-tags) 
> result)
>     (setq result
>           (pcase f
>             ("R1" "Canon EOS R1")
>             ("R5MkII” “Canon EOS R5 Mark II")
>             (_ result))))
> #+END_SRC
> 
> #+TITLE:  call_model() Supplement
> #+AUTHOR: Perry Smith
> #+EMAIL:  [email protected]
> 
> Model is call_model() blah blah.

But in this version it comes out as it should “Canon EOS R1 Supplement"

> #+OPTIONS: tags:nil
> #+SELECT_TAGS: R1 always
> 
> #+MACRO: model (eval (dolist (f (plist-get (org-export--get-inbuffer-options) 
> :select-tags) result) (setq result (pcase f ("R1" "Canon EOS R1") ("R5MkII" 
> "EOS R5 Mark II") (_ result)))))
> 
> #+TITLE:  {{{model}}} Supplement
> #+AUTHOR: Perry Smith
> #+EMAIL:  [email protected]
> 
> Model is {{{model}}} blah blah.


But I really don’t want to maintain the second version…  (And… if you can’t 
tell, I can’t really write lisp code. :-( )

As Christian pointed out:
> So macros defined lower down the include chain can be invoked
> higher up, but not vice versa.

I need a way to define something at the top and have it be in effect down 
through the includes.  tags seem to fit that so I’m making everything work off 
of the tags that are defined.  The global macros could work but the global 
macros would have the same value as each file is processed during publication 
and that isn’t what I need.  When the R1 supplement is being published, I need 
model set to “EOS R1” and then the R5MkII is being published, I need model set 
to “EOS R5 Mark II”, etc.

As always, thank you for your time



Reply via email to