lang/org: lazyload babel src highlighters packages
E.g. ob-*.el, if any
This commit is contained in:
parent
2c140496e8
commit
eb7d4bf0e8
1 changed files with 7 additions and 0 deletions
|
@ -135,6 +135,13 @@ when executed.")
|
||||||
take one argument (the language specified in the src block, as a string). Stops
|
take one argument (the language specified in the src block, as a string). Stops
|
||||||
at the first function to return non-nil.")
|
at the first function to return non-nil.")
|
||||||
|
|
||||||
|
(defun +org*src-lazy-load-library (lang)
|
||||||
|
"Lazy load a babel package to ensure syntax highlighting."
|
||||||
|
(or (cdr (assoc lang org-src-lang-modes))
|
||||||
|
(fboundp (intern-soft (format "%s-mode" lang)))
|
||||||
|
(require (intern-soft (format "ob-%s" lang)) nil t)))
|
||||||
|
(advice-add #'org-src--get-lang-mode :before #'+org*src-lazy-load-library)
|
||||||
|
|
||||||
(defun +org*babel-lazy-load-library (info)
|
(defun +org*babel-lazy-load-library (info)
|
||||||
"Load babel libraries lazily when babel blocks are executed."
|
"Load babel libraries lazily when babel blocks are executed."
|
||||||
(let* ((lang (nth 0 info))
|
(let* ((lang (nth 0 info))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue