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 b44d52469fb7b3dc7743881e9927a01999b6fef1 (commit) from 70c649961416be00181844277a5cc34b41946839 (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 b44d52469fb7b3dc7743881e9927a01999b6fef1 Author: Tassilo Horn <t...@gnu.org> Date: Thu Dec 22 13:58:35 2016 +0100 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. 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) ----------------------------------------------------------------------- Summary of changes: 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(-) hooks/post-receive -- GNU AUCTeX _______________________________________________ auctex-diffs mailing list auctex-di...@gnu.org https://lists.gnu.org/mailman/listinfo/auctex-diffs