fix(org): don't expand latex snippets in latex segments

Yasnippet expanding snippets (on TAB) from another mode can cause
org-element warnings. Until this interop is resolved, best to not make
TAB too smart.

It still works in src blocks, however.

Fix: #8363
This commit is contained in:
Henrik Lissner
2025-04-15 16:37:59 -04:00
parent 60bf93eb9a
commit 31afe2c8b0

View File

@ -472,11 +472,9 @@ Made for `org-tab-first-hook'."
(when (and (modulep! :editor snippets) (when (and (modulep! :editor snippets)
(require 'yasnippet nil t) (require 'yasnippet nil t)
(bound-and-true-p yas-minor-mode)) (bound-and-true-p yas-minor-mode))
(let ((major-mode (cond ((org-in-src-block-p t) (let ((major-mode (if (org-in-src-block-p t)
(org-src-get-lang-mode (org-eldoc-get-src-lang))) (org-src-get-lang-mode (org-eldoc-get-src-lang))
((org-inside-LaTeX-fragment-p) major-mode))
'latex-mode)
(major-mode)))
(org-src-tab-acts-natively nil) ; causes breakages (org-src-tab-acts-natively nil) ; causes breakages
;; Smart indentation doesn't work with yasnippet, and painfully slow ;; Smart indentation doesn't work with yasnippet, and painfully slow
;; in the few cases where it does. ;; in the few cases where it does.