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. a4a8140a683bd0b46ffe5


From: Tassilo Horn
Subject: [AUCTeX-diffs] GNU AUCTeX branch, master, updated. a4a8140a683bd0b46ffe51f923a73959be4cc05c
Date: Fri, 4 Nov 2016 18:51:12 +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  a4a8140a683bd0b46ffe51f923a73959be4cc05c (commit)
      from  ae65b6841e47afd8e73435b5fe170057e64afec2 (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 a4a8140a683bd0b46ffe51f923a73959be4cc05c
Author: Tassilo Horn <address@hidden>
Date:   Fri Nov 4 19:47:07 2016 +0100

    Refresh font-latex fontification if vars are modified
    
    Refresh font-latex fontification if variables such as
    LaTeX-verbatim-*-local are set in a file-local variables block or as
    directory-local variables (bug#24868).
    
    * font-latex.el (font-latex-after-hacking-local-variables): New function.
    (font-latex-setup): Add it do hack-local-variables-hook.
    * tex.el (TeX--list-of-string-p): New function.
    * latex.el (LaTeX-verbatim-environments-local):
    (LaTeX-verbatim-macros-with-braces-local):
    (LaTeX-verbatim-macros-with-delims-local): Use it for
    safe-local-variable property.

diff --git a/font-latex.el b/font-latex.el
index fb7f8d6..a7982c5 100644
--- a/font-latex.el
+++ b/font-latex.el
@@ -1258,7 +1258,11 @@ triggers Font Lock to recognize the change."
          (set (make-local-variable 'lookup-syntax-properties) t))
       (setq defaults (append defaults variables)))
     ;; Set the defaults.
-    (setq font-lock-defaults defaults)))
+    (setq font-lock-defaults defaults))
+
+  ;; Make sure fontification will be refreshed if a user sets variables
+  ;; 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-jit-lock-force-redisplay (buf start end)
   "Compatibility for Emacsen not offering `jit-lock-force-redisplay'."
@@ -1343,6 +1347,24 @@ fontification facilities like `font-lock-multiline' 
itself."
          (when (numberp ad-end)
            (ad-set-arg 1 ad-end)))))))
 
+(defun font-latex-after-hacking-local-variables ()
+  "Refresh fontification if required by updates of file-local variables.
+This function is added to `hack-local-variables-hook' and
+recomputes fontification if variables affecting fontification are
+modified.  Such variables include
+`LaTeX-verbatim-environments-local',
+`LaTeX-verbatim-macros-with-braces-local',
+`LaTeX-verbatim-macros-with-delims-local'."
+  ;; Note to self: directory-local variables are also added to
+  ;; file-local-variables-alist.
+  (let ((hacked-local-vars (mapcar #'car file-local-variables-alist)))
+    (when (or (memq 'LaTeX-verbatim-environments-local hacked-local-vars)
+             (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))))
 
 ;;; Utility functions
 
diff --git a/latex.el b/latex.el
index c21699d..56cb491 100644
--- a/latex.el
+++ b/latex.el
@@ -2785,6 +2785,9 @@ Programs should not use this variable directly but the 
function
 including values of the variable
 `LaTeX-verbatim-macros-with-delims' as well.")
 (make-variable-buffer-local 'LaTeX-verbatim-macros-with-delims-local)
+(put 'LaTeX-verbatim-macros-with-delims-local 'safe-local-variable
+     #'TeX--list-of-string-p)
+
 
 (defcustom LaTeX-verbatim-macros-with-braces nil
   "Macros for inline verbatim with arguments in braces, like \\foo{...}.
@@ -2807,6 +2810,8 @@ Programs should not use this variable directly but the 
function
 including values of the variable
 `LaTeX-verbatim-macros-with-braces' as well.")
 (make-variable-buffer-local 'LaTeX-verbatim-macros-with-braces-local)
+(put 'LaTeX-verbatim-macros-with-braces-local 'safe-local-variable
+     #'TeX--list-of-string-p)
 
 (defcustom LaTeX-verbatim-environments
   '("verbatim" "verbatim*")
@@ -2829,6 +2834,8 @@ Programs should not use this variable directly but the 
function
 `LaTeX-verbatim-environments' which returns a value including
 values of the variable `LaTeX-verbatim-environments' as well.")
 (make-variable-buffer-local 'LaTeX-verbatim-environments-local)
+(put 'LaTeX-verbatim-environments-local 'safe-local-variable
+     #'TeX--list-of-string-p)
 
 (defun LaTeX-verbatim-macros-with-delims ()
   "Return list of verbatim macros with delimiters."
diff --git a/tex.el b/tex.el
index 1836f66..e192899 100644
--- a/tex.el
+++ b/tex.el
@@ -6665,6 +6665,16 @@ Emacs 21."
          (string-to-number (replace-match "\\1" nil nil string))
        0))))
 
+(defun TeX--list-of-string-p (lst)
+  "Return non-nil iff `LST' is a list of strings.
+Used as function for validating a variable's `safe-local-variable' property."
+  (and (listp lst)
+       (let ((all-strings t))
+        (while (and all-strings lst)
+          (setq all-strings (stringp (car lst)))
+          (setq lst (cdr lst)))
+        all-strings)))
+
 (provide 'tex)
 
 ;; Local Variables:

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

Summary of changes:
 font-latex.el |   24 +++++++++++++++++++++++-
 latex.el      |    7 +++++++
 tex.el        |   10 ++++++++++
 3 files changed, 40 insertions(+), 1 deletion(-)


hooks/post-receive
-- 
GNU AUCTeX



reply via email to

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