Subject: bug#69681: 14.0.3; texmathp misbehaves in Org mode

From: Tony Zorman <[email-masked]>
Date: Sat, 09 Mar 2024 20:27:59 +0100

Hi,

this is mostly a follow-up on [#61410], in which texmathp.el was made
aware of verbatim constructs. The current check for this is

    (if (and (fboundp 'LaTeX-verbatim-p)
             (LaTeX-verbatim-p (cdr match)))
      …)

The comment above that code snippet mentions texmathp running as
standalone, but perhaps it was still intended to run in a TeX buffer.
The actual check in LaTeX-verbatim-p is just to see whether

    (nth 3 (syntax-ppss))

returns nil or not. However, Org mode seems to treat inline and display
maths as a string, which causes texmathp to misbehave. (I know that Org
has org--math-p as an around advice, but I disabled that for the
purposes of this test.)

Would it perhaps be possible to amend the above check to see whether the
current major mode is a TeX-derived one?

Thanks!
Tony

[#61410]: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=61410

Emacs  : GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, Motif Version 2.3.8, cairo version 1.18.0)
Package: 14.0.3

-- 
Tony Zorman | https://tony-zorman.com/