branch: externals/tex-parens
commit aa11f6c222755be2b0499b8f61608d7c4e6bca2b
Author: Paul Nelson <[email protected]>
Commit: Paul Nelson <[email protected]>

    fix bug for detection of comments and quotes in math
    
    should always check font at the beginning of the match
---
 tex-parens.el | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/tex-parens.el b/tex-parens.el
index 2b82be2bda..d7bfb8944e 100644
--- a/tex-parens.el
+++ b/tex-parens.el
@@ -292,8 +292,12 @@ then ignore comments; these are detected via
 `font-lock-comment-face'.  If M-STR is a double prime in math
 mode, then ignore it.  If M-STR is a dollar delimiter that does
 not demarcate math mode, then ignore it."
-  (or (and tp-ignore-comments (tp--comment))
-      (and (equal m-str "''") (> (tp--math-face) 0))
+  (or (and tp-ignore-comments
+           (save-excursion (goto-char m-begin)
+                           (tp--comment)))
+      (and (equal m-str "''")
+           (save-excursion (goto-char m-begin)
+                           (> (tp--math-face) 0)))
       (and (member m-str '("$" "$$"))
            (equal (save-excursion (goto-char (1- m-begin))
                                   (tp--math-face))

Reply via email to