auctex-diffs
[Top][All Lists]
Advanced

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

[AUCTeX-diffs] GNU AUCTeX branch, master, updated. bc47cb0bb0c14e123cc7c


From: Tassilo Horn
Subject: [AUCTeX-diffs] GNU AUCTeX branch, master, updated. bc47cb0bb0c14e123cc7cf192be123b520ef53d2
Date: Thu, 5 Jan 2017 10:07:34 +0000 (UTC)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU AUCTeX".

The branch, master has been updated
       via  bc47cb0bb0c14e123cc7cf192be123b520ef53d2 (commit)
      from  3a5ed086d3fc8869af01ce940c35dd54cdeb8f40 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit bc47cb0bb0c14e123cc7cf192be123b520ef53d2
Author: Tassilo Horn <address@hidden>
Date:   Thu Jan 5 11:04:49 2017 +0100

    Fontify script characters with a new face
    
    * doc/auctex.texi (Fontification of math): Document it.
    * doc/changes.texi: Mention that.
    * font-latex.el (font-latex-make-user-keywords): Adapt.
    (font-latex-script-char-face): New face.
    (font-latex-match-script-chars): Improve it so that double ^_ aren't
    matched because such errors were hard to see with
    font-latex-fontify-script set to invisible.
    (font-latex-script-char): New function.

diff --git a/doc/auctex.texi b/doc/auctex.texi
index a907fed..13661c6 100644
--- a/doc/auctex.texi
+++ b/doc/auctex.texi
@@ -2283,6 +2283,8 @@ and @i{b} would have the same font size.  If it was 3 or 
more, then
 smaller than @i{y} and @i{y} is smaller than @i{x}.
 @end defopt
 
+The script characters @samp{^} and @samp{_} themselves are also
+fontified with an own face named @code{font-latex-script-char-face}.
 
 @defopt font-latex-script-display
 Display specification for subscript and superscript content.  The car is
diff --git a/doc/changes.texi b/doc/changes.texi
index 54abc65..75daf17 100644
--- a/doc/changes.texi
+++ b/doc/changes.texi
@@ -40,7 +40,9 @@ each one raised above and a bit smaller than its basis.  For 
this
 feature, have a look at the customize options
 @code{font-latex-fontify-script} (especially the new values
 @code{multi-level} and @code{invisible}) and
address@hidden
address@hidden  Also, the script characters
address@hidden and @samp{_} are also fontified with a special face named
address@hidden
 @ifclear rawfile
 @xref{Fontification of math}, for details.
 @end ifclear
diff --git a/font-latex.el b/font-latex.el
index 1a52284..eed7eb9 100644
--- a/font-latex.el
+++ b/font-latex.el
@@ -820,7 +820,7 @@ Generated by `font-latex-make-user-keywords'.")))
             (font-latex-match-script
              (1 (font-latex-script (match-beginning 0)) append))
             (font-latex-match-script-chars
-             (0 '(face font-latex-math-face invisible t)))))
+             (1 (font-latex-script-char (match-beginning 1)) t))))
     (add-to-list 'font-latex-keywords-2 item t)))
 (font-latex-make-user-keywords)
 
@@ -1156,6 +1156,22 @@ have changed."
   "Face used for subscripts."
   :group 'font-latex-highlighting-faces)
 
+(defface font-latex-script-char-face
+  (let ((font (cond ((assq :inherit custom-face-attributes)
+                    '(:inherit underline))
+                   (t '(:underline t)))))
+    `((((class grayscale) (background light))
+       (:foreground "DarkGray" ,@font))
+      (((class grayscale) (background dark))
+       (:foreground "gray" ,@font))
+      (((class color) (background light))
+       (:foreground "salmon"))
+      (((class color) (background dark))
+       (:foreground "DarkRed"))
+      (t (,@font))))
+  "Face used for the script chars ^ and _."
+  :group 'font-latex-highlighting-faces)
+
 (defface font-latex-slide-title-face
   (let* ((scale 1.2)
         (size (when (featurep 'xemacs)
@@ -1963,9 +1979,9 @@ END marks boundaries for searching for quotation ends."
     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)))
+  "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
@@ -2036,6 +2052,14 @@ END marks boundaries for searching for quotation ends."
            (font-latex--get-script-props pos :super)
          'font-latex-superscript-face)))))
 
+(defun font-latex-script-char (pos)
+  "Return face and display spec for subscript and superscript character at 
POS."
+  (if (boundp 'font-lock-extra-managed-props)
+      `(face font-latex-script-char-face
+            ,@(when (eq font-latex-fontify-script 'invisible)
+                '(invisible t)))
+    'font-latex-script-char-face))
+
 ;;; docTeX
 
 (defvar font-latex-doctex-preprocessor-face

-----------------------------------------------------------------------

Summary of changes:
 doc/auctex.texi  |    2 ++
 doc/changes.texi |    4 +++-
 font-latex.el    |   32 ++++++++++++++++++++++++++++----
 3 files changed, 33 insertions(+), 5 deletions(-)


hooks/post-receive
-- 
GNU AUCTeX



reply via email to

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