summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAchim Gratz <Stromeko@Stromeko.DE>2013-03-09 22:22:49 +0100
committerAchim Gratz <Stromeko@Stromeko.DE>2013-03-09 23:09:15 +0100
commit4f7d514f13df118a8a81d2049db7c949a83f3177 (patch)
treec85c09f6459cea055b9838b6b410cae4bc74bd8b
parentd7758f565cda072b416fec9ff6d0a4b4b48485a0 (diff)
downloadorg-mode-4f7d514f13df118a8a81d2049db7c949a83f3177.tar.gz
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
-rw-r--r--lisp/ob-core.el18
1 files changed, 14 insertions, 4 deletions
diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index b782d87..8625e3e 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -325,9 +325,16 @@ Do not query the user."
(message (format "Evaluation of this%scode-block%sis disabled."
code-block block-name))))))
+ ;; dynamically scoped for asynchroneous export
+(defvar org-babel-confirm-evaluate-answer-no)
+
(defsubst org-babel-confirm-evaluate (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
interactive code block evaluations will proceed without any
confirmation from the user.
@@ -336,9 +343,12 @@ Note disabling confirmation may result in accidental evaluation
of potentially harmful code."
(org-babel-check-confirm-evaluate info
(not (when query
- (unless (yes-or-no-p (format
- "Evaluate this%scode block%son your system? "
- code-block block-name))
+ (unless
+ (and (not (org-bound-and-true-p
+ 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."
code-block block-name)))))))