auctex-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[AUCTeX-diffs] Changes to auctex/font-latex.el


From: Ralf Angeli
Subject: [AUCTeX-diffs] Changes to auctex/font-latex.el
Date: Thu, 25 May 2006 14:08:40 +0000

Index: auctex/font-latex.el
diff -u auctex/font-latex.el:5.154 auctex/font-latex.el:5.155
--- auctex/font-latex.el:5.154  Thu May 25 07:50:57 2006
+++ auctex/font-latex.el        Thu May 25 14:08:40 2006
@@ -115,6 +115,12 @@
 (defvar font-latex-quotes-control nil
   "Internal variable for keeping track if `font-latex-quotes' changed.")
 
+(defvar font-latex-quotes-internal nil
+  "Internal variable for tracking outcome of automatic detection.
+If automatic detection is not enabled, it is assigned the value
+of `font-latex-quotes'.")
+(make-variable-buffer-local 'font-latex-quotes-internal)
+
 (defvar font-latex-quotes-fallback 'french
   "Fallback value for `font-latex-quotes' if automatic detection fails.")
 
@@ -147,6 +153,24 @@
   (make-local-variable 'font-latex-quote-list)
   (add-to-list 'font-latex-quote-list quotes))
 
+(defun font-latex-quotes-set-internal ()
+  "Set `font-latex-quotes-internal' according to `font-latex-quotes'.
+If `font-latex-quotes' is set to `auto', try to derive the
+correct value from document properties."
+  (setq font-latex-quotes-internal
+       (if (eq font-latex-quotes 'auto)
+           (or (when (TeX-elt-of-list-member
+                      font-latex-quote-style-list-french TeX-active-styles)
+                 'french)
+               (when (TeX-elt-of-list-member
+                      font-latex-quote-style-list-german TeX-active-styles)
+                 'german)
+               font-latex-quotes-fallback)
+         font-latex-quotes)))
+;; Update the value of `font-latex-quotes-internal' when the list of
+;; styles changes.
+(add-hook 'TeX-update-style-hook 'font-latex-quotes-set-internal)
+
 ;; The definitions of the title faces were originally taken from
 ;; info.el (Copyright (C) 1985, 86, 92, 93, 94, 95, 96, 97, 98, 99,
 ;; 2000, 2001 Free Software Foundation, Inc.) and adapted to the needs
@@ -978,18 +1002,6 @@
        ((eq font-latex-do-multi-line t)
         (setq font-latex-use-cache t)))
 
-  ;; Language-specific quotation mark matching.
-  (when (eq font-latex-quotes 'auto)
-    (let ((styles (TeX-style-list)))
-      (set (make-local-variable 'font-latex-quotes)
-          (or (when (TeX-elt-of-list-member font-latex-quote-style-list-french
-                                            styles)
-                'french)
-              (when (TeX-elt-of-list-member font-latex-quote-style-list-german
-                                            styles)
-                'german)
-              font-latex-quotes-fallback))))
-
   ;; Tell Font Lock about the support.
   (make-local-variable 'font-lock-defaults)
   ;; The test for `major-mode' currently only works with docTeX mode
@@ -1451,15 +1463,17 @@
   ;; Update quotes list and regexp if value of `font-latex-quotes' changed.
   (unless (eq font-latex-quotes-control font-latex-quotes)
     (setq font-latex-quotes-control font-latex-quotes)
+    (font-latex-quotes-set-internal)
     ;; Set order of each entry in `font-latex-quote-list' according to
-    ;; setting of `font-latex-quotes'.
+    ;; setting of `font-latex-quotes-internal'.
     (let ((tail font-latex-quote-list)
          elt)
       (while tail
        (setq elt (car tail))
        (when (and (> (safe-length elt) 2)
-                  (not (eq (nth 2 elt) font-latex-quotes)))
-         (setcar tail (list (nth 1 elt) (nth 0 elt) font-latex-quotes)))
+                  (not (eq (nth 2 elt) font-latex-quotes-internal)))
+         (setcar tail (list (nth 1 elt) (nth 0 elt)
+                            font-latex-quotes-internal)))
        (setq tail (cdr tail))))
     (setq font-latex-quote-regexp-beg
          (regexp-opt (mapcar 'car font-latex-quote-list) t)))




reply via email to

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