fix(org): tab not invoking cdlatex-tab in headings

In org-mode, if one writes a math expression in a section (i.e. heading)
while using cdlatex, pressing tab indents the section instead of
performing a cdlatex-tab.

This fix takes care of this issue to have the wanted behavior: if in
math environment and hit tab while in section, execute cdlatex-tab.

Close: #5926
Co-authored-by: roiholtzman <roiholtzman@users.noreply.github.com>
This commit is contained in:
Henrik Lissner 2022-01-03 16:41:37 +01:00
parent b37d8481ce
commit 67a9573f0d

View file

@ -375,6 +375,10 @@ Made for `org-tab-first-hook' in evil-mode."
(cond ((not (and (bound-and-true-p evil-local-mode) (cond ((not (and (bound-and-true-p evil-local-mode)
(evil-insert-state-p))) (evil-insert-state-p)))
nil) nil)
((and (bound-and-true-p org-cdlatex-mode)
(or (org-inside-LaTeX-fragment-p)
(org-inside-latex-macro-p)))
nil)
((org-at-item-p) ((org-at-item-p)
(if (eq this-command 'org-shifttab) (if (eq this-command 'org-shifttab)
(org-outdent-item-tree) (org-outdent-item-tree)
@ -441,7 +445,10 @@ of the time I just want to peek into the current subtree -- at most, expand
All my (performant) foldings needs are met between this and `org-show-subtree' All my (performant) foldings needs are met between this and `org-show-subtree'
(on zO for evil users), and `org-cycle' on shift-TAB if I need it." (on zO for evil users), and `org-cycle' on shift-TAB if I need it."
(interactive "P") (interactive "P")
(unless (eq this-command 'org-shifttab) (unless (or (eq this-command 'org-shifttab)
(and (bound-and-true-p org-cdlatex-mode)
(or (org-inside-LaTeX-fragment-p)
(org-inside-latex-macro-p))))
(save-excursion (save-excursion
(org-beginning-of-line) (org-beginning-of-line)
(let (invisible-p) (let (invisible-p)