[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[AUCTeX-diffs] [elpa] externals/auctex bc47cb0 39/57: Fontify script cha
From: |
Tassilo Horn |
Subject: |
[AUCTeX-diffs] [elpa] externals/auctex bc47cb0 39/57: Fontify script characters with a new face |
Date: |
Wed, 11 Jan 2017 18:01:41 +0000 (UTC) |
branch: externals/auctex
commit bc47cb0bb0c14e123cc7cf192be123b520ef53d2
Author: Tassilo Horn <address@hidden>
Commit: Tassilo Horn <address@hidden>
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.
---
doc/auctex.texi | 2 ++
doc/changes.texi | 4 +++-
font-latex.el | 32 ++++++++++++++++++++++++++++----
3 files changed, 33 insertions(+), 5 deletions(-)
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
- [AUCTeX-diffs] [elpa] externals/auctex def20e7 05/57: Make AUCTeX and RefTeX aware of file loading macro \subfile, (continued)
- [AUCTeX-diffs] [elpa] externals/auctex def20e7 05/57: Make AUCTeX and RefTeX aware of file loading macro \subfile, Tassilo Horn, 2017/01/11
- [AUCTeX-diffs] [elpa] externals/auctex ac02ed2 02/57: Extend test for new column counting code with style files loaded, Tassilo Horn, 2017/01/11
- [AUCTeX-diffs] [elpa] externals/auctex 89ea0e4 19/57: Fix name of macros \lcnamecref and \lcnamecrefs, Tassilo Horn, 2017/01/11
- [AUCTeX-diffs] [elpa] externals/auctex 4747c24 29/57: Simple docfix, Tassilo Horn, 2017/01/11
- [AUCTeX-diffs] [elpa] externals/auctex 4c42f7a 25/57: Revert "Remove multi-level/invisible feature of font-latex-fontify-script", Tassilo Horn, 2017/01/11
- [AUCTeX-diffs] [elpa] externals/auctex 1addc62 30/57: Use RefTeX for multiple citations in biblatex, Tassilo Horn, 2017/01/11
- [AUCTeX-diffs] [elpa] externals/auctex 0b16551 51/57: * Makefile.in (release-commit): Use UTF-8 coding for ChangeLog entry., Tassilo Horn, 2017/01/11
- [AUCTeX-diffs] [elpa] externals/auctex 0766526 41/57: Don't use cl function copy-list, Tassilo Horn, 2017/01/11
- [AUCTeX-diffs] [elpa] externals/auctex a181b14 55/57: ; make change-history-commit, Tassilo Horn, 2017/01/11
- [AUCTeX-diffs] [elpa] externals/auctex 61e56f2 40/57: Fix bug where font-latex-sub/superscript-face was not applied to ^_, Tassilo Horn, 2017/01/11
- [AUCTeX-diffs] [elpa] externals/auctex bc47cb0 39/57: Fontify script characters with a new face,
Tassilo Horn <=
- [AUCTeX-diffs] [elpa] externals/auctex bef4873 22/57: Set `reftex-set-cite-format' to biblatex or natbib, Tassilo Horn, 2017/01/11
- [AUCTeX-diffs] [elpa] externals/auctex 1de2359 13/57: Add new style/titlesec.el, Tassilo Horn, 2017/01/11
- [AUCTeX-diffs] [elpa] externals/auctex 01da194 23/57: ; * style/titletoc.el ("titletoc"): Use `TeX-arg-length'., Tassilo Horn, 2017/01/11
- [AUCTeX-diffs] [elpa] externals/auctex 69fc320 27/57: Add a newline only if \label is inserted, Tassilo Horn, 2017/01/11
- [AUCTeX-diffs] [elpa] externals/auctex 343ca9c 36/57: Fix script unfontification bug, Tassilo Horn, 2017/01/11
- [AUCTeX-diffs] [elpa] externals/auctex 0e54895 34/57: Improve completion docs, Tassilo Horn, 2017/01/11
- [AUCTeX-diffs] [elpa] externals/auctex 436371c 31/57: Add completion-at-point support, Tassilo Horn, 2017/01/11
- [AUCTeX-diffs] [elpa] externals/auctex e9c4b68 35/57: ; * doc/auctex.texi (Completion): Use @defun and not @deffn., Tassilo Horn, 2017/01/11
- [AUCTeX-diffs] [elpa] externals/auctex 93b1163 50/57: * ChangeLog-preview: Change encoding to UTF-8., Tassilo Horn, 2017/01/11
- [AUCTeX-diffs] [elpa] externals/auctex 4ebbf90 56/57: Make gitlog-to-changelog ignore release-commit, Tassilo Horn, 2017/01/11