org-babel-lob-get-info: Add no-eval argument

* lisp/ob-lob.el (org-babel-lob-get-info): Add no-eval argument to
prevent recursive evaluation of lisp values in parameters.
This commit is contained in:
fpi 2022-10-18 17:27:54 +02:00 committed by Ihor Radchenko
parent 4b9aef20d8
commit bbec9aafee
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
3 changed files with 11 additions and 6 deletions

View File

@ -29,7 +29,7 @@
(require 'ob-core)
(declare-function org-babel-lob-get-info "ob-lob" (&optional datum))
(declare-function org-babel-lob-get-info "ob-lob" (&optional datum no-eval))
(declare-function org-element-at-point "org-element" (&optional pom cached-only))
(declare-function org-element-context "org-element" (&optional element))
(declare-function org-element-property "org-element" (property element))

View File

@ -119,11 +119,16 @@ after REF in the Library of Babel."
(cdr (assoc-string ref org-babel-library-of-babel))))))))
;;;###autoload
(defun org-babel-lob-get-info (&optional datum)
(defun org-babel-lob-get-info (&optional datum no-eval)
"Return internal representation for Library of Babel function call.
Consider DATUM, when provided, or element at point otherwise.
When optional argument NO-EVAL is non-nil, Babel does not resolve
remote variable references; a process which could likely result
in the execution of other code blocks, and do not evaluate Lisp
values in parameters.
Return nil when not on an appropriate location. Otherwise return
a list compatible with `org-babel-get-src-block-info', which
see."
@ -144,16 +149,16 @@ see."
org-babel-default-lob-header-args
(append
(org-with-point-at begin
(org-babel-params-from-properties language))
(org-babel-params-from-properties language no-eval))
(list
(org-babel-parse-header-arguments
(org-element-property :inside-header context))
(org-element-property :inside-header context) no-eval)
(let ((args (org-element-property :arguments context)))
(and args
(mapcar (lambda (ref) (cons :var ref))
(org-babel-ref-split-args args))))
(org-babel-parse-header-arguments
(org-element-property :end-header context)))))
(org-element-property :end-header context) no-eval))))
nil
(org-element-property :name context)
begin

View File

@ -57,7 +57,7 @@
(require 'org-macs)
(require 'cl-lib)
(declare-function org-babel-lob-get-info "ob-lob" (&optional datum))
(declare-function org-babel-lob-get-info "ob-lob" (&optional datum no-eval))
(declare-function org-element-at-point "org-element" (&optional pom cached-only))
(declare-function org-element-property "org-element" (property element))
(declare-function org-element-type "org-element" (element))