summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Schulte <schulte.eric@gmail.com>2011-11-21 18:19:45 -0700
committerEric Schulte <schulte.eric@gmail.com>2011-11-21 18:19:45 -0700
commitedef1fa5cadcf6f8e1b389983d18ccedc81b4f65 (patch)
treec8e39afac4689704bda291626cb7186fdfaeb3d7
parent3693952e3b36148b9f294a7ccdb361d86a3cdd6f (diff)
downloadorg-mode-edef1fa5cadcf6f8e1b389983d18ccedc81b4f65.tar.gz
":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".
-rw-r--r--doc/org.texi14
-rw-r--r--lisp/ob.el4
2 files changed, 11 insertions, 7 deletions
diff --git a/doc/org.texi b/doc/org.texi
index 544a4ef..9bf5a9e 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -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
diff --git a/lisp/ob.el b/lisp/ob.el
index 33013b8..710b1d1 100644
--- a/lisp/ob.el
+++ b/lisp/ob.el
@@ -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)))