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: Mon, 22 May 2006 18:29:06 +0000

Index: auctex/font-latex.el
diff -u auctex/font-latex.el:5.152 auctex/font-latex.el:5.153
--- auctex/font-latex.el:5.152  Sun May 21 08:31:58 2006
+++ auctex/font-latex.el        Mon May 22 18:29:06 2006
@@ -115,13 +115,29 @@
 (defvar font-latex-quotes-control nil
   "Internal variable for keeping track if `font-latex-quotes' changed.")
 
-(defcustom font-latex-quotes 'french
+(defvar font-latex-quotes-fallback 'french
+  "Fallback value for `font-latex-quotes' if automatic detection fails.")
+
+(defvar font-latex-quote-style-list-french
+  '("french" "frenchb" "frenchle" "frenchpro" "francais" "canadien"
+    "acadian" "italian")
+  "List of styles for which French-style quote matching should be activated.")
+
+(defvar font-latex-quote-style-list-german
+  '("austrian" "german" "germanb" "naustrian" "ngerman")
+  "List of styles for which German-style quote matching should be activated.")
+
+(defcustom font-latex-quotes 'auto
   "Whether to fontify << French quotes >> or >>German quotes<<.
-Also selects \"<quote\"> versus \">quote\"<."
-  :type '(choice (const french) (const german))
+Also selects \"<quote\"> versus \">quote\"<.
+
+If value `auto' is chosen, an attempt is being made in deriving
+the type of quotation mark matching from document settings like
+the language option supplied to the babel package."
+  :type '(choice (const auto) (const french) (const german))
   :group 'font-latex)
 (put 'font-latex-quotes 'safe-local-variable
-     '(lambda (x) (memq x '(french german))))
+     '(lambda (x) (memq x '(auto french german))))
 
 (defun font-latex-add-quotes (quotes)
   "Add QUOTES to `font-latex-quote-list'.
@@ -962,6 +978,18 @@
        ((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




reply via email to

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