Perry Smith <[email protected]> writes: > The TITLE in this version comes out just “Supplement" > [...] >> >> #+TITLE: call_model() Supplement
Right. You're out of luck here: the =CALL_<src>()= syntax just doesn't work in in-buffer settings like =#+TITLE=. I should probably have mentioned that when I suggested it. This is a documented (albeit easy-to-miss) limitation: https://orgmode.org/manual/Evaluating-Code-Blocks.html#DOCF156 > 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 [...] > > But I really don’t want to maintain the second version… (And… if you > can’t tell, I can’t really write lisp code. :-( ) Actually, no, I can't tell! I very well understand why you wouldn't want to maintain that on a macro line, though. Besides, Babel gives you the freedom to code that selection function in any other supported language you like, while macros are limited to elisp. But if you need conditional text for TITLE (or SUBTITLE, AUTHOR, etc.), I think your only options are (a) to resign yourself to tweaking the TITLE manually (in addition to the SELECT_TAGS you have to tweak anyway) or (b) use a macro. Possibly you could generalize the macro code to a function in your init file so you could use shorter macro definitions. It is also possible to add an export filter to change the the final output, so you could add a string like "%model%" in the title and match/replace it at the end of the export process, but that's a whole other approach again. I see from your follow-up mail you got something to work, anyway. Regards, Christian
