summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Schulte <schulte.eric@gmail.com>2010-07-06 09:39:07 -0700
committerEric Schulte <schulte.eric@gmail.com>2010-07-06 09:39:07 -0700
commit804d08b119e6b883f55b7194a74e9bc1ddf5f4d3 (patch)
tree15f26ec7ed2d7ddbe562a44e311986dda705ca63
parent2cc4c0d564e042ba902d74d264fafdf10ee423c3 (diff)
downloadorg-mode-804d08b119e6b883f55b7194a74e9bc1ddf5f4d3.tar.gz
babel: don't ask twice for confirmation with :eval query
Thanks to Carsten for the Patch * lisp/ob.el (org-babel-confirm-evaluate): don't ask twice for confirmation with :eval query
-rw-r--r--lisp/ob.el18
1 files changed, 8 insertions, 10 deletions
diff --git a/lisp/ob.el b/lisp/ob.el
index 0b33d97..7469876 100644
--- a/lisp/ob.el
+++ b/lisp/ob.el
@@ -171,18 +171,16 @@ any confirmation from the user.
Note disabling confirmation may result in accidental evaluation
of potentially harmful code."
- (let ((eval (cdr (assoc :eval (nth 2 info)))))
+ (let* ((eval (cdr (assoc :eval (nth 2 info))))
+ (query (or (equal eval "query")
+ (and (functionp org-confirm-babel-evaluate)
+ (funcall org-confirm-babel-evaluate
+ (nth 0 info) (nth 1 info)))
+ org-confirm-babel-evaluate)))
(when (or (equal eval "never")
- (and (equal eval "query")
+ (and query
(not (yes-or-no-p
- (format "Evaluate this%scode on your system?"
- (if info (format " %s " (nth 0 info)) " ")))))
- (and (or (and (functionp org-confirm-babel-evaluate)
- (funcall org-confirm-babel-evaluate
- (nth 0 info) (nth 1 info)))
- org-confirm-babel-evaluate)
- (not (yes-or-no-p
- (format "Evaluate this%scode on your system?"
+ (format "Evaluate this%scode on your system? "
(if info (format " %s " (nth 0 info)) " "))))))
(error "evaluation aborted"))))