":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
@subsubsection @code{:eval}
The @code{:eval} header argument can be used to limit the evaluation of
specific code blocks. @code{:eval} accepts two arguments ``never'' and
``query''. @code{:eval never} (or @code{:eval no}) will ensure that a code
block is never evaluated, this can be useful for protecting against the
evaluation of dangerous code blocks. @code{:eval query} will require a query
for every execution of a code block regardless of the value of the
@code{org-confirm-babel-evaluate} variable.
specific code blocks. @code{:eval} accepts three arguments ``never'',
``query'' and ``non-export''. @code{:eval never} (or @code{:eval no}) will
ensure that a code block is never evaluated, this can be useful for
protecting against the evaluation of dangerous code blocks. @code{:eval
query} will require a query for every execution of a code block regardless of
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
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)))
(t org-confirm-babel-evaluate))))
(if (or (equal eval "never") (equal eval "no")
(and (equal eval "non-export") org-current-export-file)
(and query
(not (yes-or-no-p
(format "Evaluate this%scode block%son your system? "
@ -264,7 +265,8 @@ of potentially harmful code."
(if (nth 4 info)
(format " (%s) " (nth 4 info)) " "))))))
(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")))
t)))