emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/auctex 57338ec 24/78: Improve my last commit


From: Tassilo Horn
Subject: [elpa] externals/auctex 57338ec 24/78: Improve my last commit
Date: Mon, 19 Oct 2015 09:10:47 +0000

branch: externals/auctex
commit 57338ec5c37b84d3407f6068274662c6258780f2
Author: Tassilo Horn <address@hidden>
Commit: Tassilo Horn <address@hidden>

    Improve my last commit
---
 ChangeLog     |    2 +-
 font-latex.el |   35 ++++++++++++++++++-----------------
 2 files changed, 19 insertions(+), 18 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 703db99..53a7c0c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,7 +7,7 @@
        (font-latex-match-script): Use it.
        (font-latex-make-user-keywords): Add font-lock entry for script
        signs.
-       (font-latex-script-invisible): New function.
+       (font-latex-match-script-chars): New function.
 
        * tex.el (TeX-tex-mode): Don't ignore case when matching the
        TeX-format-list regexes.
diff --git a/font-latex.el b/font-latex.el
index 0df8a96..eefa849 100644
--- a/font-latex.el
+++ b/font-latex.el
@@ -819,7 +819,8 @@ Generated by `font-latex-make-user-keywords'.")))
              (0 'font-latex-sedate-face append))
             (font-latex-match-script
              (1 (font-latex-script (match-beginning 0)) append))
-            ("[_^]" (0 (font-latex-script-invisible (match-beginning 0)) t))))
+            (font-latex-match-script-chars
+             (0 '(face font-latex-math-face invisible t)))))
     (add-to-list 'font-latex-keywords-2 item t)))
 (font-latex-make-user-keywords)
 
@@ -1891,6 +1892,22 @@ END marks boundaries for searching for quotation ends."
                              (list beg beg beg beg))))))
     t))
 
+(defun font-latex-match-script-chars (limit)
+  (and (eq font-latex-fontify-script 'invisible)
+       (re-search-forward "[_^]" limit t)
+       (let ((pos (match-beginning 0)))
+        (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))))))
+
 ;; Copy and adaption of `tex-font-lock-suscript' from tex-mode.el in
 ;; GNU Emacs on 2004-07-07.
 (defun font-latex-script (pos)
@@ -1923,22 +1940,6 @@ END marks boundaries for searching for quotation ends."
                   ,(cdr font-latex-script-display))
          'font-latex-superscript-face)))))
 
-(defun font-latex-script-invisible (pos)
-  "Make the super/subscript sign invisible."
-  (when (and (eq font-latex-fontify-script 'invisible)
-            (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)))
-    `(face nil invisible t)))
-
 ;;; docTeX
 
 (defvar font-latex-doctex-preprocessor-face



reply via email to

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