auctex-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[AUCTeX-diffs] [elpa] externals/auctex 40b9319 7/8: Fix matching of scri


From: Tassilo Horn
Subject: [AUCTeX-diffs] [elpa] externals/auctex 40b9319 7/8: Fix matching of script chars (bug#48012)
Date: Sun, 25 Apr 2021 15:22:52 -0400 (EDT)

branch: externals/auctex
commit 40b9319b80cd5ad6892126b03599cdc626837d59
Author: Tassilo Horn <tsdh@gnu.org>
Commit: Tassilo Horn <tsdh@gnu.org>

    Fix matching of script chars (bug#48012)
    
    * font-latex.el (font-latex-match-script-chars): Don't stop after
    findind the first script char which turns out not to be an actual
    script char (bug#48012).
---
 font-latex.el | 28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/font-latex.el b/font-latex.el
index 7ba3792..906afc9 100644
--- a/font-latex.el
+++ b/font-latex.el
@@ -2141,19 +2141,21 @@ set to french, and >>german<< (and 8-bit) are used if 
set to german."
 
 (defun font-latex-match-script-chars (limit)
   "Match subscript and superscript chars up to LIMIT."
-  (and (re-search-forward "[^_^]\\([_^]\\)" limit t)
-       (let ((pos (match-beginning 1)))
-         (and (font-latex-faces-present-p 'font-latex-math-face pos)
-              (not (font-latex-faces-present-p '(font-lock-constant-face
-                                                 font-lock-builtin-face
-                                                 font-lock-comment-face
-                                                 font-latex-verbatim-face) 
pos))
-              ;; Check for backslash quoting
-              (not (let ((odd nil)
-                         (pos pos))
-                     (while (eq (char-before pos) ?\\)
-                       (setq pos (1- pos) odd (not odd)))
-                     odd))))))
+  (catch 'found
+    (while (re-search-forward "[^_^]\\([_^]\\)" limit t)
+      (let ((pos (match-beginning 1)))
+        (when (and (font-latex-faces-present-p 'font-latex-math-face pos)
+                   (not (font-latex-faces-present-p '(font-lock-constant-face
+                                                      font-lock-builtin-face
+                                                      font-lock-comment-face
+                                                      
font-latex-verbatim-face) pos))
+                   ;; Check for backslash quoting
+                   (not (let ((odd nil)
+                              (pos pos))
+                          (while (eq (char-before pos) ?\\)
+                            (setq pos (1- pos) odd (not odd)))
+                          odd)))
+          (throw 'found t))))))
 
 (defun font-latex--get-script-props (pos script-type)
   (let* ((old-raise (or (plist-get (get-text-property pos 'display) 'raise) 
0.0))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]