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

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

[elpa] 296/299: Fix indentation of tabularx environment closing.


From: Stefan Monnier
Subject: [elpa] 296/299: Fix indentation of tabularx environment closing.
Date: Sun, 02 Nov 2014 03:12:05 +0000

monnier pushed a commit to branch externals/auctex
in repository elpa.

commit 700587fe36b0104eba7dd30bef869ba3349a66d1
Author: Matthew Leach <address@hidden>
Date:   Wed Oct 29 17:46:24 2014 +0100

    Fix indentation of tabularx environment closing.
    
    * latex.el (LaTeX-indent-environment-list): Remove setter
    lambda.
    (LaTeX--tabular-like-end): Remove variable.
    (LaTeX-indent-tabular): Move setter function from
    LaTeX-indent-environment-list to generate tabular-end regex when
    called.
    
    Signed-off-by: Mosè Giordano <address@hidden>
---
 ChangeLog |    9 ++++++++
 latex.el  |   64 ++++++++++++++++++++++++++----------------------------------
 2 files changed, 37 insertions(+), 36 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 897a9b8..22813c0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2014-10-29  Matthew Leach  <address@hidden>
+
+       * latex.el (LaTeX-indent-environment-list): Remove setter
+       lambda.
+       (LaTeX--tabular-like-end): Remove variable.
+       (LaTeX-indent-tabular): Move setter function from
+       LaTeX-indent-environment-list to generate tabular-end regex when
+       called.
+
 2014-10-29  Mos� Giordano  <address@hidden>
 
        * latex.el (LaTeX-largest-level-set): Set `outline-heading-alist'
diff --git a/latex.el b/latex.el
index 33e4720..b56abf3 100644
--- a/latex.el
+++ b/latex.el
@@ -2852,25 +2852,7 @@ The second element in each entry is the function to 
calculate the
 indentation level in columns."
     :group 'LaTeX-indentation
     :type '(repeat (list (string :tag "Environment")
-                        (option function)))
-    :set (lambda (symbol value)
-           (setq LaTeX--tabular-like-end
-                 (format "\\\\end{%s}"
-                         (regexp-opt
-                          (let (out)
-                            (mapc (lambda (x)
-                                    (when (eq (cadr x) 'LaTeX-indent-tabular)
-                                      (push (car x) out)))
-                                  value)
-                            out))))
-           (set-default symbol value)))
-
-(defvar LaTeX--tabular-like-end nil
-  "A regexp matching tabular-like environment ends.
-Those will be aligned with `LaTeX-indent-tabular'.
-
-Do not set this variable. This variable is auto-set
-by customizing `LaTeX-indent-environment-list'.")
+                        (option function))))
 
 (defcustom LaTeX-indent-environment-check t
   "*If non-nil, check for any special environments."
@@ -6311,23 +6293,33 @@ i.e. you do _not_ have to cater for this yourself by 
adding \\\\' or $."
   "Return indent column for the current tabular-like line."
   (destructuring-bind (beg-pos . beg-col)
       (LaTeX-env-beginning-pos-col)
-    (cond ((looking-at LaTeX--tabular-like-end)
-           beg-col)
-
-          ((looking-at "\\\\\\\\")
-           (+ 2 beg-col))
-
-          ((looking-at "&")
-           (LaTeX-hanging-ampersand-position))
-
-          (t
-           (+ 2
-              (let ((any-col (save-excursion
-                               (when (re-search-backward "\\\\\\\\\\|&" 
beg-pos t)
-                                 (current-column)))))
-                (if (and any-col (string= "&" (match-string 0)))
-                    any-col
-                  beg-col)))))))
+    (let ((tabular-like-end-regex
+           (format "\\\\end{%s}"
+                   (regexp-opt
+                    (let (out)
+                      (mapcar (lambda (x)
+                              (when (eq (cadr x) 'LaTeX-indent-tabular)
+                                (push (car x) out)))
+                              LaTeX-indent-environment-list)
+                      (pp out)
+                      out)))))
+      (cond ((looking-at tabular-like-end-regex)
+             beg-col)
+
+            ((looking-at "\\\\\\\\")
+             (+ 2 beg-col))
+
+            ((looking-at "&")
+             (LaTeX-hanging-ampersand-position))
+
+            (t
+             (+ 2
+                (let ((any-col (save-excursion
+                                 (when (re-search-backward "\\\\\\\\\\|&" 
beg-pos t)
+                                   (current-column)))))
+                  (if (and any-col (string= "&" (match-string 0)))
+                      any-col
+                    beg-col))))))))
 
 (provide 'latex)
 



reply via email to

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