Function: org-babel-confirm-evaluate

org-babel-confirm-evaluate is a byte-compiled function defined in ob-core.el.gz.

Signature

(org-babel-confirm-evaluate INFO)

Documentation

Confirm evaluation of the code block INFO.

This query can also be suppressed by setting the value of org-confirm-babel-evaluate to nil, in which case all future interactive code block evaluations will proceed without any confirmation from the user.

Note disabling confirmation may result in accidental evaluation of potentially harmful code.

The variable org-babel-confirm-evaluate-answer-no is used by the async export process, which requires a non-interactive environment, to override this check.

Source Code

;; Defined in /usr/src/emacs/lisp/org/ob-core.el.gz
(defun org-babel-confirm-evaluate (info)
  "Confirm evaluation of the code block INFO.

This query can also be suppressed by setting the value of
`org-confirm-babel-evaluate' to nil, in which case all future
interactive code block evaluations will proceed without any
confirmation from the user.

Note disabling confirmation may result in accidental evaluation
of potentially harmful code.

The variable `org-babel-confirm-evaluate-answer-no' is used by
the async export process, which requires a non-interactive
environment, to override this check."
  (let* ((evalp (org-babel-check-confirm-evaluate info))
	 (lang (nth 0 info))
	 (name (nth 4 info))
	 (name-string (if name (format " (%s) " name) " ")))
    (pcase evalp
      (`nil nil)
      (`t t)
      (`query (or
	       (and (not (bound-and-true-p
			  org-babel-confirm-evaluate-answer-no))
		    (yes-or-no-p
		     (format "Evaluate this %s code block%son your system? "
			     lang name-string)))
	       (progn
		 (message "Evaluation of this %s code block%sis aborted."
			  lang name-string)
		 nil)))
      (x (error "Unexpected value `%s' from `org-babel-check-confirm-evaluate'" x)))))