Re: Executing Org Code Block w/o Confirmation?

Rafi Khan <[email protected]>
Newsgroups gmane.emacs.help
Message-ID <CACGw+Y6k3EpoO1ebbNOZ5xZ+Ct6=6HSTRbinBwqHr2YDDK562g@mail.gmail.com>
On Mon, Aug 17, 2026 at 8:41 PM Rafi Khan <[email protected]> wrote:

> I'll take a stab at seeing how this might be added as a feature of
> org-mode itself.
>
> --

A small attempt.

New to elisp, so mostly just got as far as a working implementation.
Will clean it up further hopefully this week and submit a patch to the
orgmode list.

1 file changed, 10 insertions(+), 4 deletions(-)
lisp/ob-core.el | 14 ++++++++++----

modified   lisp/ob-core.el
@@ -889,10 +889,16 @@ guess will be made."
               (unless noninteractive
                 (message (format "Cached: %s"
                                  (replace-regexp-in-string "%" "%%"
(format "%S" result)))))
-              result)))
-         ((org-babel-confirm-evaluate info)
-          (let* ((lang (nth 0 info))
-                 (result-params (cdr (assq :result-params params)))
+              result)))
+         ((let ((evalSafe  (equal  (read (cdr (assq :eval params)))
+                                   t)))
+            (when evalSafe
+              (setq org-confirm-babel-evaluate nil))
+            (org-babel-confirm-evaluate info)
+            (when evalSafe
+              (setq org-confirm-babel-evaluate t)))
+          (let* ((lang (nth 0 info))
+                 (result-params (cdr (assq :result-params params)))
                  (body (org-babel--expand-body info))
                  (dir (cdr (assq :dir params)))
                  (mkdirp (cdr (assq :mkdirp params)))

--
My Best,
Rafi
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.