auctex-diffs
[Top][All Lists]
Advanced

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

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


From: Ralf Angeli
Subject: [AUCTeX-diffs] Changes to auctex/latex.el
Date: Wed, 30 Nov 2005 04:31:57 -0500

Index: auctex/latex.el
diff -u auctex/latex.el:5.389 auctex/latex.el:5.390
--- auctex/latex.el:5.389       Mon Oct 31 09:40:40 2005
+++ auctex/latex.el     Wed Nov 30 09:31:57 2005
@@ -1200,6 +1200,22 @@
 
 (add-hook 'TeX-auto-prepare-hook 'LaTeX-auto-prepare)
 
+(defun LaTeX-listify-package-options (options)
+  "Return a list from a comma-separated string of package OPTIONS.
+The input string may include LaTeX comments and newlines."
+  ;; FIXME: Parse key=value options like "pdftitle={A Perfect
+  ;; Day},colorlinks=false" correctly.  When this works, the check for
+  ;; "=" can be removed again.
+  (let (opts)
+    (dolist (elt (TeX-split-string "\\(,\\|%[^\n\r]*[\n\r]\\)+"
+                                  options))
+      (unless (string-match "=" elt)
+       ;; Strip whitespace.
+       (dolist (item (TeX-split-string "[ \t\r\n]+" elt))
+         (unless (string= item "")
+           (add-to-list 'opts item)))))
+    opts))
+
 (defun LaTeX-auto-cleanup ()
   "Cleanup after LaTeX parsing."
 
@@ -1221,19 +1237,7 @@
        (setq LaTeX-auto-style (cdr LaTeX-auto-style))
 
        ;; Get the options.
-       ;; FIXME: Parse key=value options like "pdftitle={A Perfect
-       ;; Day},colorlinks=false" correctly.  When this works, the
-       ;; check for "=" can be removed again.
-       (setq options
-             (let (opts)
-               (dolist (elt (TeX-split-string "\\(,\\|%[^\n\r]*[\n\r]\\)+"
-                                              options))
-                 (unless (string-match "=" elt)
-                   ;; Strip whitespace.
-                   (dolist (item (TeX-split-string "[ \t\r\n]+" elt))
-                     (unless (string= item "")
-                       (add-to-list 'opts item)))))
-               opts))
+       (setq options (LaTeX-listify-package-options options))
 
        ;; Add them, to the style list.
        (dolist (elt options)
@@ -1578,6 +1582,16 @@
                                 ","))))
          (setq options (read-string "Options: ")))
        (when options
+         ;; XXX: The following statement will add the options
+         ;; supplied to the LaTeX package to the style list.  This is
+         ;; consistent with the way the parser works (see
+         ;; `LaTeX-auto-cleanup').  But in a revamped style system
+         ;; such options should be associated with their LaTeX
+         ;; package to avoid confusion.  For example a `german' entry
+         ;; in the style list can come from documentclass options and
+         ;; does not necessarily mean that the babel-related
+         ;; extensions should be activated.
+         (mapcar 'TeX-run-style-hooks (LaTeX-listify-package-options options))
          (TeX-argument-insert options t))))))
 
 (defvar TeX-global-input-files nil




reply via email to

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