branch: master
commit 8ae405b9195d1c449949d930d0b2bf91458cbf48
Author: Arash Esbati <[email protected]>
Commit: Arash Esbati <[email protected]>

    Save regexp groups
    
    * latex.el (LaTeX-auto-minimal-regexp-list)
    (LaTeX-auto-class-regexp-list): Use shy groups where possible.
---
 latex.el | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/latex.el b/latex.el
index 7bada422..5e884555 100644
--- a/latex.el
+++ b/latex.el
@@ -1734,12 +1734,12 @@ right number."
 
 (defvar LaTeX-auto-minimal-regexp-list
   '(("\\\\document\\(style\\|class\\)\
-\\(\\[\\(\\([^#\\%]\\|%[^\n\r]*[\n\r]\\)*\\)\\]\\)?\
+\\(?:\\[\\(\\(?:[^#\\%]\\|%[^\n\r]*[\n\r]\\)*\\)\\]\\)?\
 {\\([^#\\.\n\r]+?\\)}"
-     (3 5 1) LaTeX-auto-style)
-    ("\\\\use\\(package\\)\\(\\[\\([^]]*\\)\\]\\)?\
+     (2 3 1) LaTeX-auto-style)
+    ("\\\\use\\(package\\)\\(?:\\[\\([^]]*\\)\\]\\)?\
 {\\(\\([^#}\\.%]\\|%[^\n\r]*[\n\r]\\)+?\\)}"
-     (3 4 1) LaTeX-auto-style))
+     (2 3 1) LaTeX-auto-style))
   "Minimal list of regular expressions matching LaTeX macro definitions.")
 
 (defvar LaTeX-auto-label-regexp-list
@@ -1761,15 +1761,15 @@ This is necessary since index entries may contain 
commands and stuff.")
 
 (defvar LaTeX-auto-class-regexp-list
   `(;; \RequirePackage[<options>]{<package>}[<date>]
-    ("\\\\Require\\(Package\\)\\(\\[\\([^]]*\\)\\]\\)?\
+    ("\\\\Require\\(Package\\)\\(?:\\[\\([^]]*\\)\\]\\)?\
 {\\([^#\\.\n\r]+?\\)}"
-     (3 4 1) LaTeX-auto-style)
+     (2 3 1) LaTeX-auto-style)
     ;; \RequirePackageWithOptions{<package>}[<date>],
     ("\\\\Require\\(Package\\)WithOptions\\(\\){\\([^#\\.\n\r]+?\\)}"
      (2 3 1) LaTeX-auto-style)
     ;; \LoadClass[<options>]{<package>}[<date>]
-    ("\\\\Load\\(Class\\)\\(\\[\\([^]]*\\)\\]\\)?{\\([^#\\.\n\r]+?\\)}"
-     (3 4 1) LaTeX-auto-style)
+    ("\\\\Load\\(Class\\)\\(?:\\[\\([^]]*\\)\\]\\)?{\\([^#\\.\n\r]+?\\)}"
+     (2 3 1) LaTeX-auto-style)
     ;; \LoadClassWithOptions{<package>}[<date>]
     ("\\\\Load\\(Class\\)WithOptions\\(\\){\\([^#\\.\n\r]+?\\)}"
      (2 3 1) LaTeX-auto-style)

Reply via email to