Function: org-babel-exp-src-block

org-babel-exp-src-block is an interactive and byte-compiled function defined in ob-exp.el.gz.

Signature

(org-babel-exp-src-block &optional ELEMENT)

Documentation

Process source block for export.

Depending on the ":export" header argument, replace the source code block like this:

both ---- display the code and the results

code ---- the default, display the code inside the block but do
          not process

results - just like none only the block is run on export ensuring
          that its results are present in the Org mode buffer

none ---- do not display either code or results upon export

Optional argument ELEMENT must contain source block element at point.

Assume point is at block opening line.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/org/ob-exp.el.gz
(defun org-babel-exp-src-block (&optional element)
  "Process source block for export.
Depending on the \":export\" header argument, replace the source
code block like this:

both ---- display the code and the results

code ---- the default, display the code inside the block but do
          not process

results - just like none only the block is run on export ensuring
          that its results are present in the Org mode buffer

none ---- do not display either code or results upon export

Optional argument ELEMENT must contain source block element at point.

Assume point is at block opening line."
  (interactive)
  (save-excursion
    (let* ((info (org-babel-get-src-block-info nil element))
	   (lang (nth 0 info))
	   (raw-params (nth 2 info))
	   hash)
      ;; bail if we couldn't get any info from the block
      (unless noninteractive
	(message "org-babel-exp process %s at position %d..."
		 lang
		 (line-beginning-position)))
      (when info
	;; if we're actually going to need the parameters
	(when (member (cdr (assq :exports (nth 2 info))) '("both" "results"))
	  (let ((lang-headers (intern (concat "org-babel-default-header-args:"
					      lang))))
	    (org-babel-exp--at-source
		(setf (nth 2 info)
		      (org-babel-process-params
		       (apply #'org-babel-merge-params
			      org-babel-default-header-args
			      (and (boundp lang-headers)
				   (symbol-value lang-headers))
			      (append (org-babel-params-from-properties lang)
				      (list raw-params)))))))
	  (setf hash (org-babel-sha1-hash info :export)))
	(org-babel-exp-do-export info 'block hash)))))