From acc72f9f42120d07cc728eeebb9dd976b4568c1f Mon Sep 17 00:00:00 2001 From: Lin Sun Date: Sat, 22 Apr 2023 00:00:39 +0000 Subject: [PATCH] *lisp/ob-core.el: load lang in (org-babel-execute-src-block) --- lisp/ob-core.el | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lisp/ob-core.el b/lisp/ob-core.el index 471887a3a..0fc4cbe9f 100644 --- a/lisp/ob-core.el +++ b/lisp/ob-core.el @@ -714,6 +714,8 @@ a list with the following pattern: (defvar *this*) ; Dynamically bound in `org-babel-execute-src-block' ; and `org-babel-read' +(defvar org-babel-load-languages) + ;;;###autoload (defun org-babel-execute-src-block (&optional arg info params executor-type) "Execute the current source code block and return the result. @@ -794,7 +796,9 @@ guess will be made." d)))) (cmd (intern (concat "org-babel-execute:" lang))) result exec-start-time) - (unless (fboundp cmd) + (unless (or (fboundp cmd) + (and (alist-get (intern lang) org-babel-load-languages) + (require (intern (concat "ob-" lang)) nil t))) (error "No org-babel-execute function for %s!" lang)) (message "Executing %s %s %s..." (capitalize lang) @@ -1952,8 +1956,6 @@ With optional prefix argument ARG, jump backward ARG many source blocks." (interactive "p") (org-previous-block arg org-babel-src-block-regexp)) -(defvar org-babel-load-languages) - ;;;###autoload (defun org-babel-mark-block () "Mark current source block." -- 2.20.5