[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[AUCTeX-diffs] [elpa] externals/auctex b44d524 35/36: Uniform font-lock
From: |
Tassilo Horn |
Subject: |
[AUCTeX-diffs] [elpa] externals/auctex b44d524 35/36: Uniform font-lock updates/don't break prettify (bug#25245) |
Date: |
Thu, 22 Dec 2016 13:08:13 +0000 (UTC) |
branch: externals/auctex
commit b44d52469fb7b3dc7743881e9927a01999b6fef1
Author: Tassilo Horn <address@hidden>
Commit: Tassilo Horn <address@hidden>
Uniform font-lock updates/don't break prettify (bug#25245)
* font-latex.el (font-latex-update-font-lock): New function.
(font-latex-add-keywords): Use it.
(font-latex-after-hacking-local-variables): Use it.
* style/alltt.el: Use font-latex-update-font-lock.
* style/beamer.el: Ditto.
* style/comment.el: Ditto.
* style/expl3.el: Ditto.
* style/fancyhdr.el: Ditto.
* style/fancyvrb.el: Ditto.
* style/listings.el: Ditto.
* style/minted.el: Ditto.
* style/url.el: Ditto.
---
font-latex.el | 34 +++++++++++++++++++++++++---------
style/alltt.el | 7 ++-----
style/beamer.el | 6 +-----
style/comment.el | 7 +++----
style/expl3.el | 7 ++-----
style/fancyhdr.el | 6 +++---
style/fancyvrb.el | 7 ++-----
style/listings.el | 7 ++-----
style/minted.el | 14 ++++----------
style/url.el | 8 +++-----
10 files changed, 47 insertions(+), 56 deletions(-)
diff --git a/font-latex.el b/font-latex.el
index e932577..df33ad0 100644
--- a/font-latex.el
+++ b/font-latex.el
@@ -225,7 +225,7 @@ effect unless you call \[font-lock-fontify-buffer] or
restart
Emacs."
;; Possibly add some words about XEmacs here. :-(
:type '(choice (number :tag "Scale factor")
- (const color))
+ (const color))
:initialize 'custom-initialize-default
:set (lambda (symbol value)
(set-default symbol value)
@@ -842,8 +842,7 @@ locking machinery will be triggered."
(dolist (elt keywords)
(add-to-list list elt))
(funcall (intern (format "font-latex-match-%s-make" class)))
- (setq font-lock-set-defaults nil)
- (font-lock-set-defaults)))
+ (font-latex-update-font-lock)))
(defvar font-latex-keywords font-latex-keywords-1
"Default expressions to highlight in TeX mode.")
@@ -1264,6 +1263,25 @@ triggers Font Lock to recognize the change."
;; influencing fontification in her file-local variables section.
(add-hook 'hack-local-variables-hook
#'font-latex-after-hacking-local-variables t t))
+(defun font-latex-update-font-lock (&optional syntactic-kws)
+ "Tell font-lock about updates of fontification rules.
+If SYNTACTIC-KWS is non-nil, also update
+`font-latex-syntactic-keywords'."
+ ;; Update syntactic keywords.
+ (when syntactic-kws
+ (font-latex-set-syntactic-keywords))
+
+ ;; Let font-lock recompute its fontification rules.
+ (setq font-lock-set-defaults nil)
+ (font-lock-set-defaults)
+
+ ;; Re-initialize prettification if needed.
+ (when (and (boundp 'prettify-symbols-mode)
+ (boundp 'prettify-symbols--keywords)
+ prettify-symbols-mode
+ prettify-symbols--keywords)
+ (font-lock-add-keywords nil prettify-symbols--keywords)))
+
(defun font-latex-jit-lock-force-redisplay (buf start end)
"Compatibility for Emacsen not offering `jit-lock-force-redisplay'."
;; The following block is an expansion of `jit-lock-force-redisplay'
@@ -1362,9 +1380,7 @@ modified. Such variables include
(memq 'LaTeX-verbatim-macros-with-braces-local hacked-local-vars)
(memq 'LaTeX-verbatim-macros-with-delims-local hacked-local-vars))
;; Ok, we need to refresh fontification.
- (font-latex-set-syntactic-keywords)
- (setq font-lock-set-defaults nil)
- (font-lock-set-defaults))))
+ (font-latex-update-font-lock t))))
;;; Utility functions
@@ -1375,7 +1391,7 @@ character. Character pairs are usually { } or [ ].
Comments are
ignored during the search."
(let ((parse-sexp-ignore-comments
(not (eq major-mode 'doctex-mode))) ; scan-sexps ignores comments
- (init-point (point))
+ (init-point (point))
(mycount 1)
(esc-char (or (and (boundp 'TeX-esc) TeX-esc) "\"))
;; XXX: Do not look up syntax-table properties since they may
@@ -1761,9 +1777,9 @@ The \begin{equation} and \end{equation} are not fontified
here."
;; XXX: Should this rather be done by
;; extending the region to be fontified?
(+ limit font-latex-multiline-boundary) 'move)
- (setq end (match-beginning 0))
+ (setq end (match-beginning 0))
(goto-char beg)
- (setq end beg))
+ (setq end beg))
(font-latex-put-multiline-property-maybe beg end)
(store-match-data (list beg end))
t)))
diff --git a/style/alltt.el b/style/alltt.el
index ccb6ac9..ed64ac4 100644
--- a/style/alltt.el
+++ b/style/alltt.el
@@ -38,13 +38,10 @@
'("alltt" current-indentation) t)
(add-to-list 'LaTeX-verbatim-environments-local "alltt")
;; Fontification
- (when (and (featurep 'font-latex)
+ (when (and (fboundp 'font-latex-update-font-lock)
(eq TeX-install-font-lock 'font-latex-setup))
- ;; For syntactic fontification, e.g. verbatim constructs.
- (font-latex-set-syntactic-keywords)
;; Tell font-lock about the update.
- (setq font-lock-set-defaults nil)
- (font-lock-set-defaults)))
+ (font-latex-update-font-lock t)))
LaTeX-dialect)
(defvar LaTeX-alltt-package-options nil
diff --git a/style/beamer.el b/style/beamer.el
index b9e5953..fe75e05 100644
--- a/style/beamer.el
+++ b/style/beamer.el
@@ -181,11 +181,7 @@
("author" "[{")
("date" "[{")
("frametitle" "<[{")) 'slide-title)
- ;; For syntactic fontification, e.g. verbatim constructs.
- (font-latex-set-syntactic-keywords)
- ;; Tell font-lock about the update.
- (setq font-lock-set-defaults nil)
- (font-lock-set-defaults)))
+ (font-latex-update-font-lock t)))
LaTeX-dialect)
(defun TeX-arg-beamer-overlay-spec (_optional &optional _prompt)
diff --git a/style/comment.el b/style/comment.el
index ac33ebd..d420e6b 100644
--- a/style/comment.el
+++ b/style/comment.el
@@ -43,7 +43,8 @@
;; New environments
(mapc 'LaTeX-add-environments LaTeX-comment-env-list)
;; Fontification
- (when (and (featurep 'font-latex)
+ (when (and (fboundp 'font-latex-add-keywords)
+ (fboundp 'font-latex-update-font-lock)
(eq TeX-install-font-lock 'font-latex-setup))
;; For syntactic fontification.
(add-to-list 'font-latex-syntactic-keywords-extra
@@ -56,15 +57,13 @@
`(,(format "^\(\\\)end *{\(?:%s\)}"
(regexp-opt LaTeX-comment-env-list))
(1 ">" t)))
- (font-latex-set-syntactic-keywords)
(font-latex-add-keywords '(("includecomment" "{")
("excludecomment" "{")
("specialcomment" "{{{")
("processcomment" "{{{{"))
'variable)
;; Tell font-lock about the update.
- (setq font-lock-set-defaults nil)
- (font-lock-set-defaults)))
+ (font-latex-update-font-lock t)))
LaTeX-dialect)
;;; comment.el ends here
diff --git a/style/expl3.el b/style/expl3.el
index 6293b87..b686b52 100644
--- a/style/expl3.el
+++ b/style/expl3.el
@@ -41,11 +41,8 @@
"expl3"
(lambda ()
(set-syntax-table LaTeX-expl3-syntax-table)
- (when (and (featurep 'font-latex)
+ (when (and (fboundp 'font-latex-update-font-lock)
(eq TeX-install-font-lock 'font-latex-setup))
- ;; For syntactic fontification, e.g. verbatim constructs.
- (font-latex-set-syntactic-keywords)
;; Tell font-lock about the update.
- (setq font-lock-set-defaults nil)
- (font-lock-set-defaults)))
+ (font-latex-update-font-lock t)))
LaTeX-dialect)
diff --git a/style/fancyhdr.el b/style/fancyhdr.el
index 76f33c7..47748ae 100644
--- a/style/fancyhdr.el
+++ b/style/fancyhdr.el
@@ -63,7 +63,8 @@
(LaTeX-add-pagestyles "fancy" "fancyplain")
;; Fontification
- (when (and (featurep 'font-latex)
+ (when (and (fboundp 'font-latex-add-keywords)
+ (fboundp 'font-latex-update-font-lock)
(eq TeX-install-font-lock 'font-latex-setup))
(font-latex-add-keywords '(("fancyhead" "[{")
("fancyfoot" "[{")
@@ -81,8 +82,7 @@
("plainheadrulewidth" "")
("plainfootrulewidth" "")) 'variable)
;; Tell font-lock about the update.
- (setq font-lock-set-defaults nil)
- (font-lock-set-defaults)))
+ (font-latex-update-font-lock)))
LaTeX-dialect)
;; Because there can be many positions, `TeX-completing-read-multiple' is used
diff --git a/style/fancyvrb.el b/style/fancyvrb.el
index 3404365..e0f7c6a 100644
--- a/style/fancyvrb.el
+++ b/style/fancyvrb.el
@@ -175,7 +175,7 @@
;; Fontification
(when (and (fboundp 'font-latex-add-keywords)
- (fboundp 'font-latex-set-syntactic-keywords)
+ (fboundp 'font-latex-update-font-lock)
(eq TeX-install-font-lock 'font-latex-setup))
(font-latex-add-keywords '(("DefineVerbatimEnvironment" "{{{")
("CustomVerbatimEnvironment" "{{{")
@@ -189,11 +189,8 @@
; actually be verbatim.
'textual)
(font-latex-add-keywords '(("fvset" "{")) 'variable)
- ;; For syntactic fontification, e.g. verbatim constructs.
- (font-latex-set-syntactic-keywords)
;; Tell font-lock about the update.
- (setq font-lock-set-defaults nil)
- (font-lock-set-defaults)))
+ (font-latex-update-font-lock t)))
LaTeX-dialect)
(defvar LaTeX-fancyvrb-package-options nil
diff --git a/style/listings.el b/style/listings.el
index e3a48a9..b2b8f90 100644
--- a/style/listings.el
+++ b/style/listings.el
@@ -351,7 +351,7 @@ with user-defined values via the \"lstdefinestyle\" macro."
(add-to-list 'LaTeX-verbatim-macros-with-braces-local "lstinline")
;; Fontification
(when (and (fboundp 'font-latex-add-keywords)
- (fboundp 'font-latex-set-syntactic-keywords)
+ (fboundp 'font-latex-update-font-lock)
(eq TeX-install-font-lock 'font-latex-setup))
(font-latex-add-keywords '(("lstnewenvironment" "{[[{{")) 'function)
(font-latex-add-keywords '(("lstinputlisting" "[{")) 'reference)
@@ -363,11 +363,8 @@ with user-defined values via the \"lstdefinestyle\" macro."
("lstdefinestyle" "{{")
("lstset" "{"))
'variable)
- ;; For syntactic fontification, e.g. verbatim constructs.
- (font-latex-set-syntactic-keywords)
;; Tell font-lock about the update.
- (setq font-lock-set-defaults nil)
- (font-lock-set-defaults)))
+ (font-latex-update-font-lock t)))
LaTeX-dialect)
(defvar LaTeX-listings-package-options '("draft" "final" "savemem"
diff --git a/style/minted.el b/style/minted.el
index a4f413d..b4bc572 100644
--- a/style/minted.el
+++ b/style/minted.el
@@ -168,13 +168,10 @@
(car name-lang)
(cadr name-lang))))
(add-to-list 'TeX-auto-symbol (list lang 'TeX-arg-file))))
- (when (and (fboundp 'font-latex-add-keywords)
- (fboundp 'font-latex-set-syntactic-keywords)
+ (when (and (fboundp 'font-latex-update-font-lock)
(eq TeX-install-font-lock 'font-latex-setup))
;; Refresh font-locking so that the verbatim envs take effect.
- (font-latex-set-syntactic-keywords)
- (setq font-lock-set-defaults nil)
- (font-lock-set-defaults)))
+ (font-latex-update-font-lock t)))
(add-hook 'TeX-auto-prepare-hook #'LaTeX-minted-auto-prepare t)
(add-hook 'TeX-auto-cleanup-hook #'LaTeX-minted-auto-cleanup t)
@@ -219,18 +216,15 @@
;; Fontification
(when (and (fboundp 'font-latex-add-keywords)
- (fboundp 'font-latex-set-syntactic-keywords)
+ (fboundp 'font-latex-update-font-lock)
(eq TeX-install-font-lock 'font-latex-setup))
(font-latex-add-keywords '(;; FIXME: Those have the form \mint{lang}|code|
;; so ideally the verbatim arg should be
;; recognized.
"mint" "mintinline")
'function)
- ;; For syntactic fontification, e.g. verbatim constructs.
- (font-latex-set-syntactic-keywords)
;; Tell font-lock about the update.
- (setq font-lock-set-defaults nil)
- (font-lock-set-defaults)))
+ (font-latex-update-font-lock t)))
LaTeX-dialect)
(defvar LaTeX-minted-package-options '("section" "chapter" "cache"
diff --git a/style/url.el b/style/url.el
index efdc297..9c36a07 100644
--- a/style/url.el
+++ b/style/url.el
@@ -57,7 +57,8 @@
(add-to-list 'LaTeX-verbatim-macros-with-braces-local "url")
;; Fontification
- (when (and (featurep 'font-latex)
+ (when (and (fboundp 'font-latex-add-keywords)
+ (fboundp 'font-latex-update-font-lock)
(eq TeX-install-font-lock 'font-latex-setup))
(font-latex-add-keywords '(("path" "{") ("url" "{")) 'reference)
(font-latex-add-keywords '(("Url" "")
@@ -74,11 +75,8 @@
("urldef" "")
("urlstyle" "{"))
'variable)
- ;; For syntactic fontification, e.g. verbatim constructs.
- (font-latex-set-syntactic-keywords)
;; Tell font-lock about the update.
- (setq font-lock-set-defaults nil)
- (font-lock-set-defaults)))
+ (font-latex-update-font-lock t)))
LaTeX-dialect)
(defun TeX-arg-urlstyle (optional &optional prompt)
- [AUCTeX-diffs] [elpa] externals/auctex 80d2a08 10/36: Min fix to kpfonts package, (continued)
- [AUCTeX-diffs] [elpa] externals/auctex 80d2a08 10/36: Min fix to kpfonts package, Tassilo Horn, 2016/12/22
- [AUCTeX-diffs] [elpa] externals/auctex 29ae5fb 15/36: Add \LTXtable to list of file-loading commands, Tassilo Horn, 2016/12/22
- [AUCTeX-diffs] [elpa] externals/auctex eb748ea 18/36: Fix query for defined colors in style/ntheorem.el, Tassilo Horn, 2016/12/22
- [AUCTeX-diffs] [elpa] externals/auctex 7518a8a 31/36: Mention that arguments to *-operator must be in braces, Tassilo Horn, 2016/12/22
- [AUCTeX-diffs] [elpa] externals/auctex e4aba95 21/36: Support RefTeX with `reftex-add-label-environments' in style/mathtools.el, Tassilo Horn, 2016/12/22
- [AUCTeX-diffs] [elpa] externals/auctex 66ed2ac 30/36: Add test for new column counting code, Tassilo Horn, 2016/12/22
- [AUCTeX-diffs] [elpa] externals/auctex f04e5f7 09/36: Add style file for amsfonts package, Tassilo Horn, 2016/12/22
- [AUCTeX-diffs] [elpa] externals/auctex 1aa46c3 23/36: ; Use third argument of `TeX-argument-insert', Tassilo Horn, 2016/12/22
- [AUCTeX-diffs] [elpa] externals/auctex 40da84e 20/36: Support RefTeX with `reftex-add-label-environments' in style/empheq.el, Tassilo Horn, 2016/12/22
- [AUCTeX-diffs] [elpa] externals/auctex d6890e8 04/36: Improve caption and label insertion in style/subcaption.el, Tassilo Horn, 2016/12/22
- [AUCTeX-diffs] [elpa] externals/auctex b44d524 35/36: Uniform font-lock updates/don't break prettify (bug#25245),
Tassilo Horn <=
- [AUCTeX-diffs] [elpa] externals/auctex 79c8264 19/36: Fix query for defined colors in style/textpos.el, Tassilo Horn, 2016/12/22
- [AUCTeX-diffs] [elpa] externals/auctex 8a14439 11/36: Add style file for subfiles package., Tassilo Horn, 2016/12/22
- [AUCTeX-diffs] [elpa] externals/auctex 6ec185e 16/36: Do not spell-check arguments of \LTXtable, Tassilo Horn, 2016/12/22
- [AUCTeX-diffs] [elpa] externals/auctex 6a31d4e 14/36: Support new floats defined with newfloat package, Tassilo Horn, 2016/12/22
- [AUCTeX-diffs] [elpa] externals/auctex 42dd1f1 22/36: Support RefTeX with `reftex-add-index-macros' in style/splitidx.el, Tassilo Horn, 2016/12/22
- [AUCTeX-diffs] [elpa] externals/auctex b59075b 06/36: Do not insert a new line if \label is omitted, Tassilo Horn, 2016/12/22
- [AUCTeX-diffs] [elpa] externals/auctex 945035c 24/36: Append tabular[xy] to `LaTeX-item-list', Tassilo Horn, 2016/12/22
- [AUCTeX-diffs] [elpa] externals/auctex 0265793 25/36: Add "s" and "S" to `LaTeX-array-column-letters', Tassilo Horn, 2016/12/22
- [AUCTeX-diffs] [elpa] externals/auctex c5d1d02 13/36: Append entry to `LaTeX-label-alist' for new "verbatim" floats, Tassilo Horn, 2016/12/22
- [AUCTeX-diffs] [elpa] externals/auctex e3c60cf 08/36: Add new style/bicaption.el, Tassilo Horn, 2016/12/22