I only want to turn off the warnings for certain source block languages.

I couldn't find an answer to this anywhere, only how to turn off the confirmation requests for all languages:

(setq org-confirm-babel-evaluate nil)

This is a super easy question for someone who knows e-lisp. It should be included with the documentation in my opinion, but there is only one language in the example.

How can I extend this to include more languages?

(defun my-org-confirm-babel-evaluate (lang body)
            (not (string= lang "ditaa")))  ; don't ask for ditaa
          (setq org-confirm-babel-evaluate 'my-org-confirm-babel-evaluate)
  • Disclaimer: I didn't try it: (member* "python" '("ditaa" "python") :test 'string=). – wvxvw Mar 21 '16 at 8:28

While I personally don't use babel much, going from the example, this should simply be:

(defun my-org-confirm-babel-evaluate (lang body)
  (not (member lang '("C" "clojure" "sh"))))

(setq org-confirm-babel-evaluate 'my-org-confirm-babel-evaluate)

Where C, clojure and sh should be replaced by the languages you don't want the confirmation for.

| improve this answer | |
  • Seems to be working fine, thanks! You need an extra bracket in there after ... "sh"))) – n1k31t4 Mar 22 '16 at 2:55
  • Oops, Thanks! That always seems to happen when I don't have paredit-mode on... – ryuslash Mar 22 '16 at 8:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.