emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/auctex f12dbb2 27/95: Improve parsing process in style/


From: Tassilo Horn
Subject: [elpa] externals/auctex f12dbb2 27/95: Improve parsing process in style/xcolor.el
Date: Sun, 16 Apr 2017 01:26:49 -0400 (EDT)

branch: externals/auctex
commit f12dbb246f28d45fbd93b0f9b82777f7db65e5f0
Author: Arash Esbati <address@hidden>
Commit: Arash Esbati <address@hidden>

    Improve parsing process in style/xcolor.el
    
    * style/xcolor.el (LaTeX-xcolor-definecolor-regexp): Use
    `regexp-opt' to build a regexp to match all color defining macros.
    (LaTeX-xcolor-colorlet-regexp): Remove variable.
    (LaTeX-xcolor-auto-cleanup): Romove unnecessary *.
---
 style/xcolor.el | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)

diff --git a/style/xcolor.el b/style/xcolor.el
index 48a0eb1..1001f66 100644
--- a/style/xcolor.el
+++ b/style/xcolor.el
@@ -1,6 +1,6 @@
 ;; xcolor.el --- AUCTeX style for `xcolor.sty' (v2.12)
 
-;; Copyright (C) 2016 Free Software Foundation, Inc.
+;; Copyright (C) 2016--2017 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <address@hidden>
 ;; Maintainer: address@hidden
@@ -233,18 +233,14 @@ remainder."
 (TeX-auto-add-type "xcolor-definecolorset" "LaTeX")
 
 (defvar LaTeX-xcolor-definecolor-regexp
-  `(,(concat "\\\\\\(?:define\\|provide\\|prepare\\)"
-            "color"
-            "\\(?:\\[\\(?:[^]]*\\)\\]\\)?{\\([^}]+\\)}")
-    1 LaTeX-auto-xcolor-definecolor)
+  (eval-when-compile
+    `(,(concat "\\\\"
+              (regexp-opt '("definecolor"  "providecolor"
+                            "preparecolor" "colorlet"))
+              "\\(?:\\[\\(?:[^]]*\\)\\]\\)?{\\([^}]+\\)}")
+      1 LaTeX-auto-xcolor-definecolor))
   "Match the argument of various color defining macros from xcolor package.")
 
-(defvar LaTeX-xcolor-colorlet-regexp
-  `(,(concat "\\\\colorlet"
-            "\\(?:\\[\\(?:[^]]*\\)\\]\\)?{\\([^}]+\\)}")
-    1 LaTeX-auto-xcolor-definecolor)
-  "Match the argument of \\colorlet macro from xcolor package.")
-
 (defvar LaTeX-xcolor-definecolorset-regexp
   `(,(concat "\\\\\\(?:define\\|provide\\|prepare\\)"
             "colorset"
@@ -268,7 +264,7 @@ xcolor package.")
     (let ((head (car colset))
          (tail (cadr colset))
          (cols (split-string
-                (replace-regexp-in-string "[ %\n\r\t]*" "" (nth 2 colset))
+                (replace-regexp-in-string "[ %\n\r\t]" "" (nth 2 colset))
                 "\\(,[^;]+;\\|,[^;]+$\\)" t)))
       (dolist (color cols)
        (LaTeX-add-xcolor-definecolors (concat head color tail))))))
@@ -371,7 +367,6 @@ xcolor.sty."
  (lambda ()
    ;; Add color to the parser.
    (TeX-auto-add-regexp LaTeX-xcolor-definecolor-regexp)
-   (TeX-auto-add-regexp LaTeX-xcolor-colorlet-regexp)
    (TeX-auto-add-regexp LaTeX-xcolor-definecolorset-regexp)
 
    ;; Add list of colors which are always available.



reply via email to

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