Hi Matt,
   Looking good here. Thanks!

On Wed, Sep 9, 2020 at 12:06 PM Matt Huszagh <huszaghm...@gmail.com> wrote:
> Tom Gillespie <tgb...@gmail.com> 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?

With the patch applied this is working on my end.

* test header
:header-args:bash: :tangle (lambda () "./from-header.sh")

#+begin_src bash :shebang "#!/usr/bin/env bash"
echo yes

> > [...] 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.

Yep, you've got it.

> > 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.


Reply via email to