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

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

[elpa] externals/auctex b1e4d46 06/28: Consider args with \newenvironmen


From: Tassilo Horn
Subject: [elpa] externals/auctex b1e4d46 06/28: Consider args with \newenvironment with opt arg
Date: Fri, 07 Aug 2015 15:59:17 +0000

branch: externals/auctex
commit b1e4d46fce02ded77c5091b641fe370ee9d5cf61
Author: Tassilo Horn <address@hidden>
Commit: Tassilo Horn <address@hidden>

    Consider args with \newenvironment with opt arg
    
    * latex.el (LaTeX-auto-env-args-with-opt): New variable for
    collecting environments with an optional argument.
    (LaTeX-auto-regexp-list): Use it.
    (LaTeX-auto-cleanup): Initialize \newenvironment{foo}[n][d]{}{}
    with the n-1 remaining mandatory arguments.
---
 ChangeLog |    8 ++++++++
 latex.el  |    9 ++++++++-
 2 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 03f529a..3d570c6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2015-06-01  Tassilo Horn  <address@hidden>
+
+       * latex.el (LaTeX-auto-env-args-with-opt): New variable for
+       collecting environments with an optional argument.
+       (LaTeX-auto-regexp-list): Use it.
+       (LaTeX-auto-cleanup): Initialize \newenvironment{foo}[n][d]{}{}
+       with the n-1 remaining mandatory arguments.
+
 2015-05-29  Nicolas Richard  <address@hidden>
 
        * latex.el (LaTeX-backward-paragraph): Make it work in narrowed
diff --git a/latex.el b/latex.el
index 3ba66c8..b869c5e 100644
--- a/latex.el
+++ b/latex.el
@@ -1370,6 +1370,7 @@ right number."
 (defvar LaTeX-auto-arguments nil)
 (defvar LaTeX-auto-optional nil)
 (defvar LaTeX-auto-env-args nil)
+(defvar LaTeX-auto-env-args-with-opt nil)
 
 (TeX-auto-add-type "label" "LaTeX")
 (TeX-auto-add-type "bibitem" "LaTeX")
@@ -1463,7 +1464,7 @@ This is necessary since index entries may contain 
commands and stuff.")
        (,(concat "\\\\\\(?:new\\|provide\\)command\\*?{?\\\\\\(" token 
"+\\)}?")
        1 TeX-auto-symbol)
        (,(concat "\\\\newenvironment\\*?{?\\(" token 
"+\\)}?\\[\\([0-9]+\\)\\]\\[")
-       1 LaTeX-auto-environment)
+       (1 2) LaTeX-auto-env-args-with-opt)
        (,(concat "\\\\newenvironment\\*?{?\\(" token 
"+\\)}?\\[\\([0-9]+\\)\\]")
        (1 2) LaTeX-auto-env-args)
        (,(concat "\\\\newenvironment\\*?{?\\(" token "+\\)}?")
@@ -1690,6 +1691,12 @@ The value is actually the tail of the list of options 
given to PACKAGE."
                       (list (nth 0 entry)
                             (string-to-number (nth 1 entry)))))
        LaTeX-auto-env-args)
+  ;; Ditto for environments with optional args
+  (mapc (lambda (entry)
+         (add-to-list 'LaTeX-auto-environment
+                      (list (nth 0 entry)
+                            (1- (string-to-number (nth 1 entry))))))
+       LaTeX-auto-env-args-with-opt)
 
   ;; Cleanup use of def to add environments
   ;; NOTE: This uses an O(N^2) algorithm, while an O(N log N)



reply via email to

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