Function: org-babel-expand-src-block

org-babel-expand-src-block is an autoloaded, interactive and byte-compiled function defined in ob-core.el.gz.

Signature

(org-babel-expand-src-block &optional ARG INFO PARAMS)

Documentation

Expand the current source code block or block specified by INFO.

INFO is the output of org-babel-get-src-block-info. PARAMS defines inherited header arguments.

Expand according to the source code block's header arguments and pop open the results in a preview buffer.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/org/ob-core.el.gz
;;;###autoload
(defun org-babel-expand-src-block (&optional _arg info params)
  "Expand the current source code block or block specified by INFO.
INFO is the output of `org-babel-get-src-block-info'.
PARAMS defines inherited header arguments.

Expand according to the source code block's header
arguments and pop open the results in a preview buffer."
  (interactive)
  (let* ((info (or info (org-babel-get-src-block-info)))
         (lang (nth 0 info))
	 (params (setf (nth 2 info)
                       (sort (org-babel-merge-params (nth 2 info) params)
                             (lambda (el1 el2) (string< (symbol-name (car el1))
							(symbol-name (car el2)))))))
         (body (setf (nth 1 info)
		     (if (org-babel-noweb-p params :eval)
			 (org-babel-expand-noweb-references info) (nth 1 info))))
         (expand-cmd (intern (concat "org-babel-expand-body:" lang)))
	 (assignments-cmd (intern (concat "org-babel-variable-assignments:"
					  lang)))
         (expanded
	  (if (fboundp expand-cmd) (funcall expand-cmd body params)
	    (org-babel-expand-body:generic
	     body params (and (fboundp assignments-cmd)
			      (funcall assignments-cmd params))))))
    (if (called-interactively-p 'any)
	(org-edit-src-code
	 expanded (concat "*Org-Babel Preview " (buffer-name) "[ " lang " ]*"))
      expanded)))