Browse Source

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
Eric Schulte 14 years ago
parent
commit
804d08b119
1 changed files with 8 additions and 10 deletions
  1. 8 10
      lisp/ob.el

+ 8 - 10
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"))))