There is one mistake in the syntax: the name of the property should not end with a colon, so the #+PROPERTY
line should read:
#+PROPERTY: header-args :eval yes
However, that only affects the first of your examples; the other two blocks are unaffected by the syntax error. The fact is that if org-confirm-babel-evaluate
is at its default value of t
, they all pop the question. Assuming that you are interpreting the doc correctly, it seems like a bug to me.
Here's the doc of the :eval
header:
The ‘eval’ header argument can limit evaluation of specific code blocks
and ‘CALL’ keyword. It is useful for protection against evaluating
untrusted code blocks by prompting for a confirmation.
‘yes’
Org always evaluates the source code without asking permission.
...
It seems pretty unequivocal that if the header is :eval yes
then Org evaluates the block with no questions asked (whatever the value of org-confirm-babel-evaluate
is). That's the way you interpreted it and I agree with your interpretation.
Unfortunately, the code does not agree:
(let* ((headers (nth 2 info))
(eval (or (cdr (assq :eval headers))
(when (assq :noeval headers) "no")))
...
(query (or (equal eval "query")
(and export (equal eval "query-export"))
(if (functionp org-confirm-babel-evaluate)
(funcall org-confirm-babel-evaluate
;; Language, code block body.
(nth 0 info)
(org-babel--expand-body info))
org-confirm-babel-evaluate))))
Even though the value of the eval
variable is "yes", the query
variable is set to whatever org-confirm-babel-evaluate
is set (in the simplest case where it is either t
or nil
- but that's the only case we are interested in here). So in the default case where org-config-babel-evaluate
is t
, then the query
value will be t
as well.
The subsequent cond
then:
(cond
(noeval nil)
(query 'query)
(t t))))
finds query
to be t
and returns the symbol query
which makes the caller of this function (org-babel-confirm-evaluate
) pop the dreaded question.
It seems to me that the query
variable in org-babel-check-confirm-evaluate
is calculated incorrectly (assuming that the doc means what it says) and that's a bug that should be reported to the Org mode ML.
One possible workaround is to modify the cond
in org-babel-check-confirm-evaluate
to check if eval
is "yes
" before going on to the query
case:
...
(cond
(noeval nil)
((equal eval "yes") t) ; add case to check `eval`
(query 'query)
(t t))))