From 03aad0a73acfca05245a01e83bae3609e6d3ed04 Mon Sep 17 00:00:00 2001 From: Tom Gillespie Date: Mon, 12 Dec 2022 17:45:14 -0800 Subject: [PATCH 2/2] * etc/ORG-NEWS: Add entry for `org-confirm-babel-evaluate-cell'. --- etc/ORG-NEWS | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index 5d5e726e0..16ff5ba67 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -12,6 +12,42 @@ See the end of the file for license conditions. Please send Org bug reports to mailto:emacs-orgmode@gnu.org. * Version 9.7 (not released yet) + +** New options +*** A new custom setting ~org-confirm-babel-evaluate-cell~ to control confirming execution of cells + +Following recent changes to ~org-babel-read~ it became annoying to +tangle files that make extensive use of elisp expression in src +block #+header: statements. + +~org-confirm-babel-evaluate-cell~ resolves the issue by making it +possible to ignore checks on cells (the old behavior) without +compromising general security for running src blocks. + +It works in the same way as ~org-confirm-babel-evaluate~, accepting a +boolean or a function of two arguments (lang body). + +Here is an example that works for ~(and)~, ~(or)~, and simple calls to +~(identity ...)~. + +#+begin_src emacs-lisp +(setq-local + org-confirm-babel-evaluate-cell + (lambda (lang body) + (ignore lang) + (let ((rb (read body))) + (not ; aka (unless condition t) + (or + (member rb '((or) (and))) + (and + (eq (car rb) 'identity) + (let ((v (cadr rb))) + (or + (symbolp v) + (stringp v) + (numberp v))))))))) +#+end_src + * Version 9.6 ** Important announcements and breaking changes -- 2.37.4