I'd like to write an Org file that would export to a html with fairly significant tweaks along the way. The rough idea is, users should be able to run reasonaly recent vanilla emacs, (require 'ox), (org-html-export-to-html) and get a fine-tuned html.
I also would like to move relevant Elisp to the end of the Org file because the text is going to be read by humans, and people with(out) certain background apparently faint too often when they see Lisp on top of a text written in markup. I put an emacs-lisp src block under the last unexported section, with header arguments :exports none :results none, but it does not seem to be evaluated on export. I couldn't find anything relevant in Info directory. I know that with vanilla emacs one needs to explicitly allow evaluation of blocks but that can be considred an acceptable preamble. It would also be great if exporting such a file would not alter the state of Emacs session too much (wouldn't pollute hooks or add advices, for example) but that's low priority. For now, I just want a self-contained customisation with minimal hassle for users to get the export result that was intended. What are my options? ----- If I may prematurely offer my vision: Common Lisp has special operator eval-when which specifies when the enclosed code is to be evaluated (or compiled). Example: (eval-when (:compile-toplevel) (defun f () ..)) specifies that function f should be defined during compilation only. I believe it would be neat if Org-mode widely supported :eval-when header argument inspired by Common Lisp's eval-when. Usage examples would be: #+begin_src emacs-lisp :eval-when compile load .. #+end_src #+begin_src emacs-lisp :eval-when tangle .. #+end_src #+begin_src emacs-lisp :eval-when export .. #+end_src #+begin_src emacs-lisp :eval-when () .. #+end_src where the last setting would be equivalent to the (now-supported) :eval never. In my case, I'd write a block with header arguments :eval-when export :results none if this feature was supported. I'm currently working on a Common Lisp-specific feature that will introduce :eval-when (it will be offered to a Common Lisp library literate-lisp) so I'm interested in opinions on this as well.