Tom Gillespie writes: > [...] I have a number of use > cases that I can imagine would benefit greatly from being able to > define a :header-args: :header (lambda () "yay!") property as a > closure (and actually I assumed that it would just work that way if I > tried to do it, clearly not though). I can't tell for sure if the > patch enables this behavior though or whether I would still get a > Wrong type argument error. This should work. Do you have reason for believing it might not? For example, set: (setq org-babel-default-header-args:bash `((:var . (lambda () "a='yay'")))) Then in file.org: #+begin_src bash :results output echo $a #+end_src Executing this will yield: #+RESULTS: : yay > [...] Looking > at the patch it seems that it preserves the behavior of performing the > evaluation of the closures at the source block, but I'm not 100% sure. I'm not sure I completely understand what you mean here. However, the closures are evaluated when point is at the source block, during the source block evaluation, not when the default headers are declared. This allows the closures to use context-dependent functionality (e.g. you can call `org-element-at-point' inside the closure and retrieve whatever information you want). Does this address your concern? Please clarify if I've missed your point. > If the default header closures are being evaluated before checking > whether they have been superseded by the headers on a block then that > is incorrect and they should not be evaluated until it is clear that > they are the value of the header for that block and have not been > superseded. I've fixed my patch (attached) so that now closures are only evaluated when they are used as part of the final set of headers.