fix(org): check :async on already loaded languages

Running a regular/`:sync` source block would prevent successive
invocations of blocks of that same language with `:async` from loading
`ob-async`.
This commit is contained in:
Samuel Tschiedel 2025-10-21 21:20:49 -03:00 committed by Henrik Lissner
parent bf62193238
commit 4b7431cba3

View file

@ -298,11 +298,11 @@ Also adds support for a `:sync' parameter to override `:async'."
"Load babel libraries lazily when babel blocks are executed."
(defun +org--babel-lazy-load (lang &optional async)
(cl-check-type lang (or symbol null))
(unless (cdr (assq lang org-babel-load-languages))
(when async
;; ob-async has its own agenda for lazy loading packages (in the child
;; process), so we only need to make sure it's loaded.
(when async
(require 'ob-async nil t))
(unless (cdr (assq lang org-babel-load-languages))
(prog1 (or (run-hook-with-args-until-success '+org-babel-load-functions lang)
(require (intern (format "ob-%s" lang)) nil t)
(require lang nil t))