0
0
Fork 1
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-09-29 21:07:54 +00:00

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
This commit is contained in:
Eric Schulte 2010-07-06 09:39:07 -07:00
parent 2cc4c0d564
commit 804d08b119

View file

@ -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"))))