Function: org-babel-exp-results

org-babel-exp-results is a byte-compiled function defined in ob-exp.el.gz.

Signature

(org-babel-exp-results INFO TYPE &optional SILENT HASH)

Documentation

Evaluate and return the results of the current code block for export.

Results are prepared in a manner suitable for export by Org mode. This function is called by org-babel-exp-do-export. The code block will be evaluated. Optional argument SILENT can be used to inhibit insertion of results into the buffer.

Source Code

;; Defined in /usr/src/emacs/lisp/org/ob-exp.el.gz
(defun org-babel-exp-results (info type &optional silent hash)
  "Evaluate and return the results of the current code block for export.
Results are prepared in a manner suitable for export by Org mode.
This function is called by `org-babel-exp-do-export'.  The code
block will be evaluated.  Optional argument SILENT can be used to
inhibit insertion of results into the buffer."
  (unless (and hash (equal hash (org-babel-current-result-hash)))
    (let ((lang (nth 0 info))
	  (body (if (org-babel-noweb-p (nth 2 info) :eval)
		    (org-babel-expand-noweb-references
		     info org-babel-exp-reference-buffer)
		  (nth 1 info)))
	  (info (copy-sequence info))
	  (org-babel-current-src-block-location (point-marker)))
      ;; Skip code blocks which we can't evaluate.
      (when (fboundp (intern (concat "org-babel-execute:" lang)))
	(org-babel-eval-wipe-error-buffer)
	(setf (nth 1 info) body)
	(setf (nth 2 info)
	      (org-babel-exp--at-source
		  (org-babel-process-params
		   (org-babel-merge-params
		    (nth 2 info)
		    `((:results . ,(if silent "silent" "replace")))))))
	(pcase type
	  (`block (org-babel-execute-src-block nil info))
	  (`inline
	    ;; Position the point on the inline source block
	    ;; allowing `org-babel-insert-result' to check that the
	    ;; block is inline.
	    (goto-char (nth 5 info))
	    (org-babel-execute-src-block nil info))
	  (`lob
	   (save-excursion
	     (goto-char (nth 5 info))
	     (org-babel-execute-src-block nil info))))))))