branch: master
commit 0b37ed8a255b407114418080f534951f987388cb
Author: Arash Esbati <ar...@gnu.org>
Commit: Arash Esbati <ar...@gnu.org>

    Parse the value of class key
    
    * style/standalone.el (LaTeX-standalone-auto-cleanup): New function.
    ("standalone"): Use the correct function.
    (LaTeX-standalone-class-options-list): Adjust docstring.
---
 style/standalone.el | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/style/standalone.el b/style/standalone.el
index 3fac7a96..0f43bc55 100644
--- a/style/standalone.el
+++ b/style/standalone.el
@@ -39,6 +39,15 @@
                   "font-latex"
                   (keywords class))
 
+(defun LaTeX-standalone-auto-cleanup ()
+  "Parse the value of \"class\" key and run the appropriate style hook."
+  (let ((cls (TeX-member "\\`class="
+                         (cdr (assoc "standalone" 
LaTeX-provided-class-options))
+                         #'string-match)))
+    (when cls
+      (TeX-run-style-hooks (cadr (split-string cls "=" t))))))
+
+(add-hook 'TeX-auto-cleanup-hook #'LaTeX-standalone-auto-cleanup t)
 
 (TeX-add-style-hook
  "standalone"
@@ -59,12 +68,7 @@
    (when (assoc "standalone" LaTeX-provided-class-options)
      (TeX-add-symbols
       '("standaloneconfig"
-        (TeX-arg-key-val (lambda ()
-                           (append
-                            `(("class" ,LaTeX-global-class-files)
-                              ("multi" ,(append '("true" "false")
-                                                (mapcar #'car 
(LaTeX-environment-list)))))
-                            LaTeX-standalone-class-options-list))))
+        (TeX-arg-key-val (LaTeX-standalone-class-options-list)))
       '("standaloneignore" 0) )
 
      (LaTeX-add-environments "standalone")
@@ -121,7 +125,7 @@
  TeX-dialect)
 
 (defun LaTeX-standalone-class-options-list ()
-  "Class options for the standalone class."
+  "Return an alist of class options for the standalone class."
   `(("class" ,LaTeX-global-class-files)
     ("multi" ,(append '("true" "false")
                       (mapcar #'car (LaTeX-environment-list))))

Reply via email to