Browse Source

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.
fpi 2 years ago
parent
commit
bbec9aafee
3 changed files with 11 additions and 6 deletions
  1. 1 1
      lisp/ob-exp.el
  2. 9 4
      lisp/ob-lob.el
  3. 1 1
      lisp/ob-ref.el

+ 1 - 1
lisp/ob-exp.el

@@ -29,7 +29,7 @@
 
 
 (require 'ob-core)
 (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-at-point "org-element" (&optional pom cached-only))
 (declare-function org-element-context "org-element" (&optional element))
 (declare-function org-element-context "org-element" (&optional element))
 (declare-function org-element-property "org-element" (property element))
 (declare-function org-element-property "org-element" (property element))

+ 9 - 4
lisp/ob-lob.el

@@ -119,10 +119,15 @@ after REF in the Library of Babel."
 	    (cdr (assoc-string ref org-babel-library-of-babel))))))))
 	    (cdr (assoc-string ref org-babel-library-of-babel))))))))
 
 
 ;;;###autoload
 ;;;###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.
   "Return internal representation for Library of Babel function call.
 
 
 Consider DATUM, when provided, or element at point otherwise.
 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
 Return nil when not on an appropriate location.  Otherwise return
 a list compatible with `org-babel-get-src-block-info', which
 a list compatible with `org-babel-get-src-block-info', which
@@ -144,16 +149,16 @@ see."
 			org-babel-default-lob-header-args
 			org-babel-default-lob-header-args
 			(append
 			(append
 			 (org-with-point-at begin
 			 (org-with-point-at begin
-			   (org-babel-params-from-properties language))
+			   (org-babel-params-from-properties language no-eval))
 			 (list
 			 (list
 			  (org-babel-parse-header-arguments
 			  (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)))
 			  (let ((args (org-element-property :arguments context)))
 			    (and args
 			    (and args
 				 (mapcar (lambda (ref) (cons :var ref))
 				 (mapcar (lambda (ref) (cons :var ref))
 					 (org-babel-ref-split-args args))))
 					 (org-babel-ref-split-args args))))
 			  (org-babel-parse-header-arguments
 			  (org-babel-parse-header-arguments
-			   (org-element-property :end-header context)))))
+			   (org-element-property :end-header context) no-eval))))
 		 nil
 		 nil
 		 (org-element-property :name context)
 		 (org-element-property :name context)
 		 begin
 		 begin

+ 1 - 1
lisp/ob-ref.el

@@ -57,7 +57,7 @@
 (require 'org-macs)
 (require 'org-macs)
 (require 'cl-lib)
 (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-at-point "org-element" (&optional pom cached-only))
 (declare-function org-element-property "org-element" (property element))
 (declare-function org-element-property "org-element" (property element))
 (declare-function org-element-type "org-element" (element))
 (declare-function org-element-type "org-element" (element))