Function: org-babel-get-src-block-info

org-babel-get-src-block-info is a byte-compiled function defined in ob-core.el.gz.

Signature

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

Documentation

Extract information from a source block or inline source block.

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.

By default, consider the block at point. However, when optional argument DATUM is provided, extract information from that parsed object instead.

Return nil if point is not on a source block. Otherwise, return a list with the following pattern:

  (language body arguments switches name start coderef)

Source Code

;; Defined in /usr/src/emacs/lisp/org/ob-core.el.gz
(defun org-babel-get-src-block-info (&optional no-eval datum)
  "Extract information from a source block or inline source block.

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.

By default, consider the block at point.  However, when optional
argument DATUM is provided, extract information from that parsed
object instead.

Return nil if point is not on a source block.  Otherwise, return
a list with the following pattern:

  (language body arguments switches name start coderef)"
  (let* ((datum (or datum (org-element-context)))
	 (type (org-element-type datum))
	 (inline (eq type 'inline-src-block)))
    (when (memq type '(inline-src-block src-block))
      (let* ((lang (org-element-property :language datum))
	     (lang-headers (intern
			    (concat "org-babel-default-header-args:" lang)))
	     (name (org-element-property :name datum))
	     (info
	      (list
	       lang
	       (org-babel--normalize-body datum)
	       (apply #'org-babel-merge-params
		      (if inline org-babel-default-inline-header-args
			org-babel-default-header-args)
		      (and (boundp lang-headers) (eval lang-headers t))
		      (append
		       ;; If DATUM is provided, make sure we get node
		       ;; properties applicable to its location within
		       ;; the document.
		       (org-with-point-at (org-element-property :begin datum)
			 (org-babel-params-from-properties lang no-eval))
		       (mapcar (lambda (h)
				 (org-babel-parse-header-arguments h no-eval))
			       (cons (org-element-property :parameters datum)
				     (org-element-property :header datum)))))
	       (or (org-element-property :switches datum) "")
	       name
	       (org-element-property (if inline :begin :post-affiliated)
				     datum)
	       (and (not inline) (org-src-coderef-format datum)))))
	(unless no-eval
	  (setf (nth 2 info) (org-babel-process-params (nth 2 info))))
	(setf (nth 2 info) (org-babel-generate-file-param name (nth 2 info)))
	info))))