[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Fix behavior of lambda default header arg vars
From: |
Ihor Radchenko |
Subject: |
Re: [PATCH] Fix behavior of lambda default header arg vars |
Date: |
Sun, 05 Jun 2022 20:18:18 +0800 |
Matt Huszagh <huszaghmatt@gmail.com> writes:
> :var header arguments can be provided multiple times. This is supported
> directly at the source block and through the default header argument
> facility. However, this was not handled correctly when the var was
> evaluated from a closure in a default header argument (only the last var
> was taken). This patch fixes that. I've also added documentation
> explaining how to set multiple vars in the default header argument
> facility.
Thanks for the patch and sorry for the late reply.
> -arbitrary function symbol (e.g. 'some-func), since org uses
> -lexical binding. To achieve the same functionality, call the
> -function within a closure (e.g. (lambda () (some-func))).
> +evaluates to a string. Some header arguments (e.g., :var for
> +some language backends) can be provided multiple times for a
> +source block. This functionality is also supported for default
> +header arguments by providing the header argument multiple times
> +in the alist. For example:
> +
> +'((:var . \"foo=\\\"bar\\\"\")
> + (:var . \"bar=\\\"foo\\\"\"))
> +
> +A closure is evaluated when the source block is being
> +evaluated (e.g. during execution or export), with point at the
> +source block. It is not possible to use an arbitrary function
> +symbol (e.g. 'some-func), since org uses lexical binding. To
> +achieve the same functionality, call the function within a
> +closure (e.g. (lambda () (some-func))).
The new docstring is confusing. The same paragraph is talking about
closures, then multiple header args, and gives an example without
closures.
It would help if closure part and multi-variable part were split into
separate paragraphs. Also, the example is not helpful here. Are you
saying that _only some_ backends support multiple vars? Are there
backends that do not support? Or are you talking about multiple
assignments to the same variable?
Best,
Ihor
- Re: [PATCH] Fix behavior of lambda default header arg vars,
Ihor Radchenko <=