org-confirm-babel-evaluate
can be set to nil
to disable confirmation.
From the documentation:
Source code blocks
Source code blocks can be evaluated during export, or when pressing
‘C-c C-c’ in the block. The most important thing to realize here
is that Org mode files which contain code snippets are, in a
certain sense, like executable files. So you should accept them
and load them into Emacs only from trusted sources—just like you
would do with a program you install on your computer.
Make sure you know what you are doing before customizing the
variables which take off the default security brakes.
-- User Option: org-confirm-babel-evaluate
When t (the default), the user is asked before every code
block evaluation. When ‘nil’, the user is not asked. When
set to a function, it is called with two arguments (language
and body of the code block) and should return t to ask and
‘nil’ not to ask.
As suggested by @Emmanuel Goldstein, the :eval
header argument can be used for finer control. It can be set to refuse evaluation, ask confirmation, directly evaluate, for each source block.
From the documentation:
The :eval
header argument can limit evaluation of specific code
blocks. It is useful for protection against evaluating untrusted src
code blocks by prompting for a confirmation. This protection is
independent of the ‘org-confirm-babel-evaluate’ setting.
- ‘never or no’
Org will never evaluate this ‘src’ code block.
- ‘query’
Org prompts the user for permission to evaluate this ‘src’ code
block.
- ‘never-export or no-export’
Org will not evaluate this ‘src’ code block when exporting, yet the
user can evaluate this source block interactively.
- ‘query-export’
Org prompts the user for permission to export this ‘src’ code
block.
If :eval
header argument is not set for a source block, then Org
determines whether to evaluate from the org-confirm-babel-evaluate
variable.