forked from mirrors/org-mode
ob-core: allow auto-denial of source block evaluation
* lisp/ob-core.el (org-babel-confirm-evaluate-answer-no): Dynamically scoped variable, if bound non-nil the confirmation dialog will not be initiated and denial of evaluation is assumed. The new variable `org-babel-confirm-evaluate-answer-no´ can be bound to suppress the user interaction as is needed for async export, as discussed in http://thread.gmane.org/gmane.emacs.orgmode/67719
This commit is contained in:
parent
d7758f565c
commit
4f7d514f13
|
@ -325,9 +325,16 @@ Do not query the user."
|
||||||
(message (format "Evaluation of this%scode-block%sis disabled."
|
(message (format "Evaluation of this%scode-block%sis disabled."
|
||||||
code-block block-name))))))
|
code-block block-name))))))
|
||||||
|
|
||||||
|
;; dynamically scoped for asynchroneous export
|
||||||
|
(defvar org-babel-confirm-evaluate-answer-no)
|
||||||
|
|
||||||
(defsubst org-babel-confirm-evaluate (info)
|
(defsubst org-babel-confirm-evaluate (info)
|
||||||
"Confirm evaluation of the code block INFO.
|
"Confirm evaluation of the code block INFO.
|
||||||
This behavior can be suppressed by setting the value of
|
|
||||||
|
If the variable `org-babel-confirm-evaluate-answer-no´ is bound
|
||||||
|
to a non-nil value, auto-answer with \"no\".
|
||||||
|
|
||||||
|
This query can also be suppressed by setting the value of
|
||||||
`org-confirm-babel-evaluate' to nil, in which case all future
|
`org-confirm-babel-evaluate' to nil, in which case all future
|
||||||
interactive code block evaluations will proceed without any
|
interactive code block evaluations will proceed without any
|
||||||
confirmation from the user.
|
confirmation from the user.
|
||||||
|
@ -336,9 +343,12 @@ Note disabling confirmation may result in accidental evaluation
|
||||||
of potentially harmful code."
|
of potentially harmful code."
|
||||||
(org-babel-check-confirm-evaluate info
|
(org-babel-check-confirm-evaluate info
|
||||||
(not (when query
|
(not (when query
|
||||||
(unless (yes-or-no-p (format
|
(unless
|
||||||
"Evaluate this%scode block%son your system? "
|
(and (not (org-bound-and-true-p
|
||||||
code-block block-name))
|
org-babel-confirm-evaluate-answer-no))
|
||||||
|
(yes-or-no-p
|
||||||
|
(format "Evaluate this%scode block%son your system? "
|
||||||
|
code-block block-name)))
|
||||||
(message (format "Evaluation of this%scode-block%sis aborted."
|
(message (format "Evaluation of this%scode-block%sis aborted."
|
||||||
code-block block-name)))))))
|
code-block block-name)))))))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue