Function: org-babel-lob-get-info

org-babel-lob-get-info is an autoloaded and byte-compiled function defined in ob-lob.el.gz.

Signature

(org-babel-lob-get-info &optional DATUM NO-EVAL)

Documentation

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.

The evaluation happens in the context of DATUM (babel call or inline babel call) for its local arguments, while evaluation of the references code block happens in the context (with point at) of that block. org-babel-current-src-block-location is bound to DATUM position during evaluation.

Return nil when not on an appropriate location. Otherwise return a list compatible with org-babel-get-src-block-info, which see.

Source Code

;; Defined in /usr/src/emacs/lisp/org/ob-lob.el.gz
;;;###autoload
(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.

The evaluation happens in the context of DATUM (babel call or inline
babel call) for its local arguments, while evaluation of the references
code block happens in the context (with point at) of that block.
`org-babel-current-src-block-location' is bound to DATUM position
during evaluation.

Return nil when not on an appropriate location.  Otherwise return
a list compatible with `org-babel-get-src-block-info', which
see."
  (let* ((context (or datum (org-element-context)))
	 (type (org-element-type context))
	 (reference (org-element-property :call context)))
    (when (memq type '(babel-call inline-babel-call))
      (let* ((begin (org-element-property (if (eq type 'inline-babel-call)
					      :begin
					    :post-affiliated)
					  context))
             ;; Signal downstream to lisp parameter values about current location.
             (org-babel-current-src-block-location begin))
        (pcase (org-babel-lob--src-info reference (if no-eval nil 'eval))
	  (`(,language ,body ,header ,_ ,_ ,_ ,coderef)
	   (list language
                 body
                 (apply #'org-babel-merge-params
                        header
                        org-babel-default-lob-header-args
                        (append
                         (org-with-point-at begin
			   (org-babel-params-from-properties language no-eval))
                         (list
			  (org-babel-parse-header-arguments
			   (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) no-eval))))
                 nil
                 (org-element-property :name context)
                 begin
                 coderef))
          (_ nil))))))