Prevent errors when `org-current-export-file' is void.

* ob.el (org-babel-confirm-evaluate): Prevent errors when
`org-current-export-file' is void.

Thanks to John Wiegley for reporting this.
This commit is contained in:
Bastien Guerry 2012-07-10 22:07:43 +02:00
parent 69aa5ab26f
commit 7b6171735f

View file

@ -285,15 +285,18 @@ of potentially harmful code."
(let* ((eval (or (cdr (assoc :eval (nth 2 info)))
(when (assoc :noeval (nth 2 info)) "no")))
(query (cond ((equal eval "query") t)
((and org-current-export-file
((and (boundp 'org-current-export-file)
org-current-export-file
(equal eval "query-export")) t)
((functionp org-confirm-babel-evaluate)
(funcall org-confirm-babel-evaluate
(nth 0 info) (nth 1 info)))
(t org-confirm-babel-evaluate))))
(if (or (equal eval "never") (equal eval "no")
(and org-current-export-file (or (equal eval "no-export")
(equal eval "never-export")))
(and (boundp 'org-current-export-file)
org-current-export-file
(or (equal eval "no-export")
(equal eval "never-export")))
(and query
(not (yes-or-no-p
(format "Evaluate this%scode block%son your system? "