Hi Bill, The `org-confirm-babel-evaluate' variable can be set to a function which can query the user to confirm code block evaluation. The following code does two things. 1) it creates and maintains a list of the files that the user has said are safe for evaluation (this list will need to be rebuilt every time you re-start Emacs) 2) it shows the language and body of the code block to the user when querying for evaluation
--8<---------------cut here---------------start------------->8--- (setq babel-safe-files '()) (defun my-babel-confirmation (lang body) (let ((file (buffer-file-name))) (if (member file babel-safe-files) nil (if (y-or-n-p (format (concat "#+begin_src %s\n%s#+end_src\n" "Evaluate this code block " "(and all others in this file) " "on your system? ") lang body)) (prog1 nil (setq babel-safe-files (cons file babel-safe-files))) t)))) (setq org-confirm-babel-evaluate #'my-babel-confirmation) --8<---------------cut here---------------end--------------->8--- This above can be added to your configuration to get close to the functionality you describe. I agree that the default confirmation should show the code block in question when asking if it should be evaluated. I'll add this to our development task list. Note: the above requires that you pull down the latest version of Org-mode. Best -- Eric Bill Harris <bill_har...@facilitatedsystems.com> writes: > Noorul Islam <noo...@noorul.com> writes: > >> How about setting `org-confirm-babel-evaluate' to nil > > Noorul, > > Thank you for the suggestion. Setting that to nil, according to the > documentation, prevents _any_ confirmation requests in any file, at > least as best as I can tell. I don't really want that. > > What I want is to have to confirm once at the first code block in an org > file and then have the rest go without confirmation. Since I don't see > the code blocks anyway when I get asked for confirmation, I'm not sure > there's a lot of benefit to a confirmation request on each block, but I > do want a reminder that there is one or more code blocks in a file > before I blithely execute the entire thing. > > Bill _______________________________________________ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode