org-lint: Improve heuristics for unknown src block language

* lisp/org-lint.el (org-lint-suspicious-language-in-src-block): Do not
complain about src block languages without execute function if there
is <lang>-mode major mode available.

Reported-by: Suhail Singh <suhailsingh247@gmail.com>
Link: https://orgmode.org/list/874ja7ik7h.fsf@gmail.com
This commit is contained in:
Ihor Radchenko 2024-06-05 17:08:50 +02:00
parent 04d56f757f
commit 51aea49462
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 4 additions and 1 deletions

View File

@ -542,7 +542,10 @@ Use :header-args: instead"
(org-element-map ast 'src-block
(lambda (b)
(when-let ((lang (org-element-property :language b)))
(unless (functionp (intern (format "org-babel-execute:%s" lang)))
(unless (or (functionp (intern (format "org-babel-execute:%s" lang)))
;; No babel backend, but there is corresponding
;; major mode.
(fboundp (org-src-get-lang-mode lang)))
(list (org-element-property :post-affiliated b)
(format "Unknown source block language: '%s'" lang)))))))