mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-07-16 21:16:28 +00:00
ob-core.el: Improve org-babel-default-header-args docstring
* lisp/ob-core.el (org-babel-default-header-args): Provide an example illustrating one benefit of using closures as default header arguments. Additionally, explain how to provide the same type of header argument multiple times in the default alist.
This commit is contained in:
parent
e8dd98d151
commit
8be689f119
|
@ -482,12 +482,14 @@ For the format of SAFE-LIST, see `org-babel-safe-header-args'."
|
||||||
This is a list in which each element is an alist. Each key
|
This is a list in which each element is an alist. Each key
|
||||||
corresponds to a header argument, and each value to that header's
|
corresponds to a header argument, and each value to that header's
|
||||||
value. The value can either be a string or a closure that
|
value. The value can either be a string or a closure that
|
||||||
evaluates to a string. The closure is evaluated when the source
|
evaluates to a string.
|
||||||
block is being evaluated (e.g. during execution or export), with
|
|
||||||
point at the source block. It is not possible to use an
|
A closure is evaluated when the source block is being
|
||||||
arbitrary function symbol (e.g. \\='some-func), since org uses
|
evaluated (e.g. during execution or export), with point at the
|
||||||
lexical binding. To achieve the same functionality, call the
|
source block. It is not possible to use an arbitrary function
|
||||||
function within a closure (e.g. (lambda () (some-func))).
|
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))).
|
||||||
|
|
||||||
To understand how closures can be used as default header
|
To understand how closures can be used as default header
|
||||||
arguments, imagine you'd like to set the file name output of a
|
arguments, imagine you'd like to set the file name output of a
|
||||||
|
@ -504,7 +506,16 @@ this with:
|
||||||
|
|
||||||
Because the closure is evaluated with point at the source block,
|
Because the closure is evaluated with point at the source block,
|
||||||
the call to `org-element-at-point' above will always retrieve
|
the call to `org-element-at-point' above will always retrieve
|
||||||
information about the current source block.")
|
information about the current source block.
|
||||||
|
|
||||||
|
Some header arguments can be provided multiple times for a source
|
||||||
|
block. An example of such a header argument is :var. 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\\\"\"))")
|
||||||
|
|
||||||
(put 'org-babel-default-header-args 'safe-local-variable
|
(put 'org-babel-default-header-args 'safe-local-variable
|
||||||
(org-babel-header-args-safe-fn org-babel-safe-header-args))
|
(org-babel-header-args-safe-fn org-babel-safe-header-args))
|
||||||
|
|
Loading…
Reference in a new issue