":eval non-export" inhibits evaluation during export

* doc/org.texi (eval): Documentation of the new :eval option.
* lisp/ob.el (org-babel-confirm-evaluate): Inhibit evaluation during
  export when eval is set to "non-export".
This commit is contained in:
Eric Schulte 2011-11-21 18:19:45 -07:00
parent 3693952e3b
commit edef1fa5ca
2 changed files with 11 additions and 7 deletions

View File

@ -13112,12 +13112,14 @@ permissions of the tangled file are set to make it executable.
@node eval, , shebang, Specific header arguments @node eval, , shebang, Specific header arguments
@subsubsection @code{:eval} @subsubsection @code{:eval}
The @code{:eval} header argument can be used to limit the evaluation of The @code{:eval} header argument can be used to limit the evaluation of
specific code blocks. @code{:eval} accepts two arguments ``never'' and specific code blocks. @code{:eval} accepts three arguments ``never'',
``query''. @code{:eval never} (or @code{:eval no}) will ensure that a code ``query'' and ``non-export''. @code{:eval never} (or @code{:eval no}) will
block is never evaluated, this can be useful for protecting against the ensure that a code block is never evaluated, this can be useful for
evaluation of dangerous code blocks. @code{:eval query} will require a query protecting against the evaluation of dangerous code blocks. @code{:eval
for every execution of a code block regardless of the value of the query} will require a query for every execution of a code block regardless of
@code{org-confirm-babel-evaluate} variable. the value of the @code{org-confirm-babel-evaluate} variable and @code{:eval
non-export} will inhibit the evaluation of code blocks during export but will
still allow interactive evaluation.
If this header argument is not set then evaluation is determined by the value If this header argument is not set then evaluation is determined by the value
of the @code{org-confirm-babel-evaluate} variable see @ref{Code evaluation of the @code{org-confirm-babel-evaluate} variable see @ref{Code evaluation

View File

@ -257,6 +257,7 @@ of potentially harmful code."
(nth 0 info) (nth 1 info))) (nth 0 info) (nth 1 info)))
(t org-confirm-babel-evaluate)))) (t org-confirm-babel-evaluate))))
(if (or (equal eval "never") (equal eval "no") (if (or (equal eval "never") (equal eval "no")
(and (equal eval "non-export") org-current-export-file)
(and query (and query
(not (yes-or-no-p (not (yes-or-no-p
(format "Evaluate this%scode block%son your system? " (format "Evaluate this%scode block%son your system? "
@ -264,7 +265,8 @@ of potentially harmful code."
(if (nth 4 info) (if (nth 4 info)
(format " (%s) " (nth 4 info)) " ")))))) (format " (%s) " (nth 4 info)) " "))))))
(prog1 nil (message "Evaluation %s" (prog1 nil (message "Evaluation %s"
(if (or (equal eval "never") (equal eval "no")) (if (or (equal eval "never") (equal eval "no")
(equal eval "non-export"))
"Disabled" "Aborted"))) "Disabled" "Aborted")))
t))) t)))