Hi Tony,

Tony Zorman via bug-auctex via Bug reporting list for AUCTeX 
<bug-auctex@gnu.org> writes:

> 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?

I don't use Org so maybe I don't understand the above correctly, but
does this change meets your requirement?

--8<---------------cut here---------------start------------->8---
diff --git a/texmathp.el b/texmathp.el
index 3316c461..ec553a3a 100644
--- a/texmathp.el
+++ b/texmathp.el
@@ -326,7 +326,8 @@ See the variable `texmathp-tex-commands' about which 
commands are checked."
     ;; `LaTeX-verbatim-p'.  We add a check here in case this library
     ;; is used stand-alone without latex.el provided by AUCTeX
     ;; (bug#61410):
-    (if (and (fboundp 'LaTeX-verbatim-p)
+    (if (and (derived-mode-p 'TeX-mode)
+             (fboundp 'LaTeX-verbatim-p)
              (LaTeX-verbatim-p (cdr match)))
         (progn
           (setq texmathp-why `(nil . ,(cdr match)))
--8<---------------cut here---------------end--------------->8---

Best, Arash



_______________________________________________
bug-auctex mailing list
bug-auctex@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-auctex
  • bug#69681: 14... Tony Zorman via bug-auctex via Bug reporting list for AUCTeX
    • bug#6968... Arash Esbati
      • bug#... Tony Zorman via bug-auctex via Bug reporting list for AUCTeX
        • ... Arash Esbati

Reply via email to