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

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

[elpa] externals/auctex 1c9de7e 29/36: Count *-operator in column specif


From: Tassilo Horn
Subject: [elpa] externals/auctex 1c9de7e 29/36: Count *-operator in column specification
Date: Thu, 22 Dec 2016 13:08:12 +0000 (UTC)

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

    Count *-operator in column specification
    
    * latex.el (LaTeX-array-count-columns): Detect *-operator in
    column specification and count the arguments for final calculation
    of columns.  Thanks to Ikumi Keita for pointing out this
    deficiency and code to fix it.
---
 latex.el |   29 ++++++++++++++++++++++++-----
 1 file changed, 24 insertions(+), 5 deletions(-)

diff --git a/latex.el b/latex.el
index 19542b1..e5601fb 100644
--- a/latex.el
+++ b/latex.el
@@ -1373,12 +1373,31 @@ right number."
 
        ;; The below block accounts for one unit of move for
        ;; one column.
-       (setq cols (+ cols (skip-chars-forward
-                           LaTeX-array-column-letters end)))
+       (setq cols (+ cols
+                     ;; treat *-operator specially.
+                     (if (eq (following-char) ?*)
+                         ;; *-operator is there.
+                         (progn
+                           ;; pick up repetition number and count
+                           ;; how many columns are repeated.
+                           (re-search-forward
+                            "\\*[ \t\r\n%]*{[ \t\r\n%]*\\([0-9]+\\)[ 
\t\r\n%]*}" end)
+                           (let ((n (string-to-number
+                                     (match-string-no-properties 1)))
+                                 ;; get start and end of repeated spec.
+                                 (s (progn (down-list 1) (point)))
+                                 (e (progn (up-list 1) (1- (point)))))
+                             (* n (1+ (LaTeX-array-count-columns s e)))))
+                       ;; not *-operator.
+                       (skip-chars-forward
+                        LaTeX-array-column-letters end))))
+       ;; Do not skip over `*' (see above) and `[' (siunitx has `S[key=val]':):
        (skip-chars-forward (concat
-                            "^" LaTeX-array-column-letters
-                            TeX-grop) end)
-       (if (eq (following-char) ?{) (forward-list 1))
+                            "^" LaTeX-array-column-letters "*"
+                            TeX-grop LaTeX-optop) end)
+       (when (or (eq (following-char) ?\{)
+                 (eq (following-char) ?\[))
+         (forward-list 1))
 
        ;; Not sure whether this is really necessary or not, but
        ;; prepare for possible infinite loop anyway.



reply via email to

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