         org-src-window-setup 'current-window
         org-confirm-babel-evaluate nil) ; you don't need my permission
 
-  (defun +org*babel-execute-src-block (orig-fn &rest args)
+  (defun +org*babel-lazy-load-library (orig-fn info)
     "Load babel libraries as needed when babel blocks are executed."
-    (let* ((language (org-element-property :language (org-element-at-point)))
-           (lang-sym (intern language)))
-      (when (and (not (cdr (assq lang-sym org-babel-load-languages)))
-                 (or (run-hook-with-args-until-success '+org-babel-load-functions language)
-                     (require
-                      (intern (format "ob-%s"
-                                      (or (cdr (assoc (downcase language) +org-babel-mode-alist))
-                                          language)))
-                      nil t)))
-        (map-put org-babel-load-languages lang-sym t))
-      (apply orig-fn args)))
-  (advice-add #'org-babel-execute-src-block :around #'+org*babel-execute-src-block)
+    (when (funcall orig-fn info)
+      (let* ((lang (nth 0 info))
+             (lang (if (symbolp lang) lang (intern lang))))
+        (when (and (not (cdr (assq lang org-babel-load-languages)))
+                   (or (run-hook-with-args-until-success '+org-babel-load-functions lang)
+                       (require
+                        (intern (format "ob-%s"
+                                        (or (cdr (assq lang +org-babel-mode-alist))
+                                            lang)))
+                        nil t)))
+          (map-put org-babel-load-languages lang t))
+        t)))
+  (advice-add #'org-babel-confirm-evaluate :around #'+org*babel-lazy-load-library)
 
   ;; I prefer C-c C-c for confirming over the default C-c '
   (map! :map org-src-mode-map "C-c C-c" #'org-edit-src-exit)


  (setq ob-ipython-resources-dir ".ob-ipython-resrc")

  (defun +org|babel-load-ipython (language)
    (and (string-match-p "^jupyter-" language)
         (require 'ob-ipython nil t)))
  (add-hook '+org-babel-load-functions #'+org|babel-load-ipython)
  :config

(add-hook 'org-load-hook #'+org|init-babel)

(defvar +org-babel-mode-alist
  '((cpp . C)
    (C++ . C)
    (D . C)
    (sh . shell)
    (bash . shell)
    (matlab . octave))
  "An alist that maps languages to babel libraries. This is necessary for babel
libraries (ob-*.el) that don't match the name of the language.")

