Skip to content

Commit 8be689f

Browse files
matthuszaghyantar92
authored andcommitted
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.
1 parent e8dd98d commit 8be689f

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

lisp/ob-core.el

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -482,12 +482,14 @@ For the format of SAFE-LIST, see `org-babel-safe-header-args'."
482482
This is a list in which each element is an alist. Each key
483483
corresponds to a header argument, and each value to that header's
484484
value. The value can either be a string or a closure that
485-
evaluates to a string. The closure is evaluated when the source
486-
block is being evaluated (e.g. during execution or export), with
487-
point at the source block. It is not possible to use an
488-
arbitrary function symbol (e.g. \\='some-func), since org uses
489-
lexical binding. To achieve the same functionality, call the
490-
function within a closure (e.g. (lambda () (some-func))).
485+
evaluates to a string.
486+
487+
A closure is evaluated when the source block is being
488+
evaluated (e.g. during execution or export), with point at the
489+
source block. It is not possible to use an arbitrary function
490+
symbol (e.g. 'some-func), since org uses lexical binding. To
491+
achieve the same functionality, call the function within a
492+
closure (e.g. (lambda () (some-func))).
491493
492494
To understand how closures can be used as default header
493495
arguments, imagine you'd like to set the file name output of a
@@ -504,7 +506,16 @@ this with:
504506
505507
Because the closure is evaluated with point at the source block,
506508
the call to `org-element-at-point' above will always retrieve
507-
information about the current source block.")
509+
information about the current source block.
510+
511+
Some header arguments can be provided multiple times for a source
512+
block. An example of such a header argument is :var. This
513+
functionality is also supported for default header arguments by
514+
providing the header argument multiple times in the alist. For
515+
example:
516+
517+
'((:var . \"foo=\\\"bar\\\"\")
518+
(:var . \"bar=\\\"foo\\\"\"))")
508519

509520
(put 'org-babel-default-header-args 'safe-local-variable
510521
(org-babel-header-args-safe-fn org-babel-safe-header-args))

0 commit comments

Comments
 (0)