[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[AUCTeX-diffs] GNU AUCTeX branch, font-latex-update, updated. a2874bcacd
From: |
Tassilo Horn |
Subject: |
[AUCTeX-diffs] GNU AUCTeX branch, font-latex-update, updated. a2874bcacd2a046e8a9edcfcfd6dc2a5f0c0ce69 |
Date: |
Thu, 14 May 2020 04:06:42 -0400 (EDT) |
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, font-latex-update has been updated
via a2874bcacd2a046e8a9edcfcfd6dc2a5f0c0ce69 (commit)
from 746fbf9f59b48d63175ea774237d4d01977638de (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 a2874bcacd2a046e8a9edcfcfd6dc2a5f0c0ce69
Author: Tassilo Horn <address@hidden>
Date: Thu May 14 10:05:53 2020 +0200
Use syntax-propertize-via-font-lock instead of syntax-propertize-rules.
That's needed because the latter doesn't support matchers with
back-references.
diff --git a/font-latex.el b/font-latex.el
index b552c93..1b98ae8 100644
--- a/font-latex.el
+++ b/font-latex.el
@@ -1,4 +1,4 @@
-;;; font-latex.el --- LaTeX fontification for Font Lock mode.
+;;; font-latex.el --- LaTeX fontification for Font Lock mode. -*-
lexical-binding: t; -*-
;; Copyright (C) 1996-2020 Free Software Foundation, Inc.
@@ -1008,7 +1008,7 @@ have changed."
;; catches the case where verbatim content is written
;; immediately after the \begin{verbatim}.
"\\(\n\\|.\\)")
- (1 "|")) t)
+ (1 "|" t)))
(add-to-list 'font-latex-syntactic-keywords
;; Using the newline character for the syntax
;; property often resulted in fontification
@@ -1018,7 +1018,7 @@ have changed."
;; in `font-latex-make-user-keywords' to remove the
;; spurious fontification of the backslash.
`(,(concat "\\(\\\\\\)end *{\\(?:" verb-envs "\\)}")
- (1 "|")) t))
+ (1 "|" t))))
(unless (= (length verb-macros-with-delims) 0)
(add-to-list 'font-latex-syntactic-keywords
`(,(concat "\\\\\\(?:" verb-macros-with-delims "\\)"
@@ -1036,7 +1036,7 @@ have changed."
;; Prevents wrong fontification of stuff
;; like "\verb|foo\|".
"\\(" (regexp-quote TeX-esc) "*\\)\\(\\1\\)")
- (1 "\"") (2 ".") (3 "\"")) t))
+ (1 "\"") (2 ".") (3 "\""))))
(unless (= (length verb-macros-with-braces) 0)
(add-to-list 'font-latex-syntactic-keywords
`(,(concat "\\\\\\(?:" verb-macros-with-braces "\\)"
@@ -1045,7 +1045,7 @@ have changed."
;; above for environments.
"\\(?:\\[[^][]*\\(?:\\[[^][]*\\][^][]*\\)*\\]\\)?"
"\\({\\).*?[^\\]\\(?:\\\\\\\\\\)*\\(}\\)")
- (1 "|") (2 "|")) t)))
+ (1 "|") (2 "|")))))
(when font-latex-syntactic-keywords-extra
(nconc font-latex-syntactic-keywords font-latex-syntactic-keywords-extra))
;; Cater for docTeX mode.
@@ -1240,14 +1240,14 @@ triggers Font Lock to recognize the change."
(setq font-lock-set-defaults nil)
(font-latex-setup))
-(defun font-latex-make-syntax-propertize-function ()
- "Generate a `syntax-propertize-function.'"
+(defun font-latex-set-syntax-propertize-function ()
+ "Set `syntax-propertize-function' after updating the syntactic keywords."
(font-latex-set-syntactic-keywords)
- (eval
- `(syntax-propertize-rules
- ,@(if (derived-mode-p 'doctex-mode)
- font-latex-doctex-syntactic-keywords
- font-latex-syntactic-keywords))))
+ (let ((keywords (if (derived-mode-p 'doctex-mode)
+ font-latex-doctex-syntactic-keywords
+ font-latex-syntactic-keywords)))
+ (setq-local syntax-propertize-function
+ (syntax-propertize-via-font-lock keywords))))
;;;###autoload
(defun font-latex-setup ()
@@ -1278,9 +1278,7 @@ triggers Font Lock to recognize the change."
font-latex-extend-region-backwards-math-envII)
(syntax-propertize-extend-region-functions
syntax-propertize-wholelines
- font-latex-sp-extend-region-backwards-verb-env)
- (syntax-propertize-function
- . ,(font-latex-make-syntax-propertize-function)))))
+ font-latex-sp-extend-region-backwards-verb-env))))
;; Add the mode-dependent stuff to the basic variables defined above.
(if (eq major-mode 'doctex-mode)
(progn
@@ -1295,9 +1293,8 @@ triggers Font Lock to recognize the change."
'((font-lock-syntactic-face-function
. font-latex-syntactic-face-function)))))
;; Set the defaults.
- (setq font-lock-defaults (append defaults variables)))
-
- (font-lock-set-defaults)
+ (setq font-lock-defaults (append defaults variables))
+ (font-latex-set-syntax-propertize-function))
;; Make sure fontification will be refreshed if a user sets variables
;; influencing fontification in her file-local variables section.
@@ -1309,8 +1306,7 @@ If SYNTACTIC-KWS is non-nil, also update
`font-latex-syntactic-keywords'."
;; Update syntactic keywords.
(when syntactic-kws
- (setq-local syntax-propertize-function
- (font-latex-make-syntax-propertize-function)))
+ (font-latex-set-syntax-propertize-function))
;; Let font-lock recompute its fontification rules.
(setq font-lock-set-defaults nil)
@@ -1330,14 +1326,13 @@ If SYNTACTIC-KWS is non-nil, also update
"Unfontify region from BEG to END."
(font-lock-default-unfontify-region beg end)
(remove-text-properties beg end '(script-level))
- (let ((start beg))
- (while (< beg end)
- (let ((next (next-single-property-change beg 'display nil end))
- (prop (get-text-property beg 'display)))
- (if (and (eq (car-safe prop) 'raise)
- (null (cddr prop)))
- (put-text-property beg next 'display nil))
- (setq beg next)))))
+ (while (< beg end)
+ (let ((next (next-single-property-change beg 'display nil end))
+ (prop (get-text-property beg 'display)))
+ (if (and (eq (car-safe prop) 'raise)
+ (null (cddr prop)))
+ (put-text-property beg next 'display nil))
+ (setq beg next))))
(defun font-latex-after-hacking-local-variables ()
"Refresh fontification if required by updates of file-local variables.
@@ -1842,7 +1837,6 @@ The \\begin{equation} incl. arguments in the same line and
"\\(?:{[^}]*}\\)*")
(- beg font-latex-multiline-boundary) t)
(< (point) beg))
- (message "EXTENDING REGION FROM %s to %s" beg (point))
(throw 'extend (cons (point) end)))))))))
(defun font-latex-update-quote-list ()
@@ -2033,7 +2027,7 @@ set to french, and >>german<< (and 8-bit) are used if set
to german."
(font-latex--get-script-props pos :sub)
(font-latex--get-script-props pos :super))))
-(defun font-latex-script-char (pos)
+(defun font-latex-script-char (_pos)
"Return face and display spec for subscript and superscript character at
POS."
`(face font-latex-script-char-face
,@(when (eq font-latex-fontify-script 'invisible)
-----------------------------------------------------------------------
Summary of changes:
font-latex.el | 54 ++++++++++++++++++++++++------------------------------
1 file changed, 24 insertions(+), 30 deletions(-)
hooks/post-receive
--
GNU AUCTeX
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [AUCTeX-diffs] GNU AUCTeX branch, font-latex-update, updated. a2874bcacd2a046e8a9edcfcfd6dc2a5f0c0ce69,
Tassilo Horn <=