org-element-map: Allow FUN to be a lisp form
* lisp/org-element-ast.el (org-element-ast-map): * lisp/org-element.el (org-element-map): Allow FUN to be a lisp form, wrapping it into lambda.
This commit is contained in:
parent
71e2ea5698
commit
5e94d5cef6
|
@ -829,6 +829,9 @@ It has to accept one argument: the node itself.
|
||||||
|
|
||||||
When TYPES is t, call FUN for all the node types.
|
When TYPES is t, call FUN for all the node types.
|
||||||
|
|
||||||
|
FUN can also be a Lisp form. The form will be evaluated as function
|
||||||
|
with symbol `node' bound to the current node.
|
||||||
|
|
||||||
When optional argument IGNORE is non-nil, it should be a list holding
|
When optional argument IGNORE is non-nil, it should be a list holding
|
||||||
nodes to be skipped. In that case, the listed nodes and their
|
nodes to be skipped. In that case, the listed nodes and their
|
||||||
contents will be skipped.
|
contents will be skipped.
|
||||||
|
@ -864,6 +867,7 @@ Nil values returned from FUN do not appear in the results."
|
||||||
(_ (list types))))
|
(_ (list types))))
|
||||||
(no-recursion (if (listp no-recursion) no-recursion
|
(no-recursion (if (listp no-recursion) no-recursion
|
||||||
(list no-recursion)))
|
(list no-recursion)))
|
||||||
|
(fun (if (functionp fun) fun `(lambda (node) ,fun)))
|
||||||
--acc)
|
--acc)
|
||||||
(letrec ((--walk-tree
|
(letrec ((--walk-tree
|
||||||
(lambda (--data)
|
(lambda (--data)
|
||||||
|
|
|
@ -4568,6 +4568,9 @@ one argument: the element or object itself.
|
||||||
|
|
||||||
When TYPES is t, call FUN for all the elements and objects.
|
When TYPES is t, call FUN for all the elements and objects.
|
||||||
|
|
||||||
|
FUN can also be a lisp form. The form will be evaluated as function
|
||||||
|
with symbol `node' bound to the current node.
|
||||||
|
|
||||||
When optional argument INFO is non-nil, it should be a plist
|
When optional argument INFO is non-nil, it should be a plist
|
||||||
holding export options. In that case, elements of the parse tree
|
holding export options. In that case, elements of the parse tree
|
||||||
\\(compared with `eq') not exportable according to `:ignore-list'
|
\\(compared with `eq') not exportable according to `:ignore-list'
|
||||||
|
|
Loading…
Reference in New Issue