auctex-diffs
[Top][All Lists]
Advanced

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

[AUCTeX-diffs] GNU AUCTeX branch, master, updated. 7518a8a3ae1a85bebd5aa


From: Arash Esbati
Subject: [AUCTeX-diffs] GNU AUCTeX branch, master, updated. 7518a8a3ae1a85bebd5aa7a9f16e9c36317c150e
Date: Mon, 19 Dec 2016 16:23:13 +0000 (UTC)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU AUCTeX".

The branch, master has been updated
       via  7518a8a3ae1a85bebd5aa7a9f16e9c36317c150e (commit)
       via  66ed2ac0732d0a0af1045091fb24535ac5d3bdbf (commit)
       via  1c9de7e71aa03fc333b1009fa74d10278f8068b5 (commit)
       via  3677ddcd6837c5b107d4a5d94059d487e928e082 (commit)
       via  76db91e3b6426ca56a2be4e9089aa5c9994629d9 (commit)
      from  a833afff74bb3534a5bce265e2478296f8152526 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 7518a8a3ae1a85bebd5aa7a9f16e9c36317c150e
Author: Arash Esbati <address@hidden>
Date:   Mon Dec 19 17:20:15 2016 +0100

    Mention that arguments to *-operator must be in braces
    
    * doc/auctex.texi (Tabular-like): Mention that the new code for
    counting columns in *{num}{cols} expects num and cols to be
    enclosed in braces.

diff --git a/doc/auctex.texi b/doc/auctex.texi
index 9420dfb..0bf2cab 100644
--- a/doc/auctex.texi
+++ b/doc/auctex.texi
@@ -1101,7 +1101,12 @@ inserts the suitable number of ampersands.
 
 You can use @kbd{C-c @key{LFD}} (@code{LaTeX-insert-item}) to terminate
 rows in these environments.  It supplies line break macro @samp{\\} and
-inserts the suitable number of ampersands on the next line.
+inserts the suitable number of ampersands on the next line.  @AUCTeX{}
+also supports the @address@hidden@address@hidden@}} notation (which may contain
+another @samp{*}-expression) in the format string when calculating the
+number of ampersands.  Please note that @samp{num} and @samp{cols} must
+be enclosed in braces; expressions like @samp{*2l} are not recognized
+correctly by the algorithm.
 
 @deffn Command LaTeX-insert-item
 @kindex C-c @key{LFD}

commit 66ed2ac0732d0a0af1045091fb24535ac5d3bdbf
Author: Arash Esbati <address@hidden>
Date:   Mon Dec 19 17:12:01 2016 +0100

    Add test for new column counting code
    
    * tests/latex/tabular-count-ampersands-out.tex:
    * tests/latex/tabular-count-ampersands-in.tex: New files.
    
    * tests/latex/latex-test.el
    (LaTeX-count-ampersands-inserted-in-tabular): Test new column
    counting code in `LaTeX-array-count-columns'.

diff --git a/tests/latex/latex-test.el b/tests/latex/latex-test.el
index cc23caf..28af7b5 100644
--- a/tests/latex/latex-test.el
+++ b/tests/latex/latex-test.el
@@ -1,6 +1,6 @@
 ;;; latex-test.el --- tests for LaTeX mode
 
-;; Copyright (C) 2014, 2015 Free Software Foundation, Inc.
+;; Copyright (C) 2014--2016 Free Software Foundation, Inc.
 
 ;; This file is part of AUCTeX.
 
@@ -48,7 +48,11 @@ line and from another directory."
  'LaTeX-math-indent/in
  "math-indent-in.tex"
  'LaTeX-math-indent/out
- "math-indent-out.tex")
+ "math-indent-out.tex"
+ 'tabular-count-ampersands/in
+ "tabular-count-ampersands-in.tex"
+ 'tabular-count-ampersands/out
+ "tabular-count-ampersands-out.tex")
 
 (ert-deftest LaTeX-indent-tabular ()
   (should (string=
@@ -106,4 +110,22 @@ line and from another directory."
             (LaTeX-insert-environment "foobar")
              (buffer-string)))))
 
+;; Test for inserting &'s with `M-RET' in various tabular environment.
+;; FIXME: One thing missing is running style hooks while running the test.
+(ert-deftest LaTeX-count-ampersands-inserted-in-tabular ()
+  (should (string=
+          (with-temp-buffer
+            (insert-file-contents tabular-count-ampersands/in)
+            (LaTeX-mode)
+            (goto-char (point-min))
+            ;; Do not ask for opt. argument in (TeX-insert-macro "\\"):
+            (let ((TeX-insert-macro-default-style 'mandatory-args-only))
+              (while (search-forward "LaTeX-insert-item" nil t)
+                (LaTeX-insert-item)))
+            (buffer-string))
+          (with-temp-buffer
+            (insert-file-contents tabular-count-ampersands/out)
+            (LaTeX-mode)
+            (buffer-string)))))
+
 ;;; latex-test.el ends here
diff --git a/tests/latex/tabular-count-ampersands-in.tex 
b/tests/latex/tabular-count-ampersands-in.tex
new file mode 100644
index 0000000..97bc5f8
--- /dev/null
+++ b/tests/latex/tabular-count-ampersands-in.tex
@@ -0,0 +1,36 @@
+\documentclass{article}
+% \usepackage{tabularx,tabulary,longtable}
+\begin{document}
+
+Standard LaTeX tabular:
+\begin{tabular}[t]{llll}
+  1 & 2 & 3 & LaTeX-insert-item
+\end{tabular}
+
+LaTeX tabular with *-operator:
+\begin{tabular}[t]{*{3}{l}r}
+  1 & 2 & 3 & LaTeX-insert-item
+\end{tabular}
+
+\begin{tabular}{*{3}{l}>{\tiny\hfill}l<{\hfill}}
+  1 & 2 & 3 & LaTeX-insert-item
+\end{tabular}
+
+\begin{tabular}[t]{*{3}{lc}r}
+  1 & 2 & 3 & 4 & 5 & 6 & LaTeX-insert-item
+\end{tabular}
+
+\begin{tabular}[t]{*{3}{lc*{2}{l}} r}
+  1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & LaTeX-insert-item
+\end{tabular}
+
+Standard LaTeX tabular*:
address@hidden@{}}
+  1 & 2 & 3 & LaTeX-insert-item
+\end{tabular*}
+
address@hidden|l}|r|}
+  1 & 2 & 3 & LaTeX-insert-item
+\end{tabular*}
+
+\end{document}
diff --git a/tests/latex/tabular-count-ampersands-out.tex 
b/tests/latex/tabular-count-ampersands-out.tex
new file mode 100644
index 0000000..1163637
--- /dev/null
+++ b/tests/latex/tabular-count-ampersands-out.tex
@@ -0,0 +1,43 @@
+\documentclass{article}
+% \usepackage{tabularx,tabulary,longtable}
+\begin{document}
+
+Standard LaTeX tabular:
+\begin{tabular}[t]{llll}
+  1 & 2 & 3 & LaTeX-insert-item \\
+    &&&
+\end{tabular}
+
+LaTeX tabular with *-operator:
+\begin{tabular}[t]{*{3}{l}r}
+  1 & 2 & 3 & LaTeX-insert-item \\
+    &&&
+\end{tabular}
+
+\begin{tabular}{*{3}{l}>{\tiny\hfill}l<{\hfill}}
+  1 & 2 & 3 & LaTeX-insert-item \\
+    &&&
+\end{tabular}
+
+\begin{tabular}[t]{*{3}{lc}r}
+  1 & 2 & 3 & 4 & 5 & 6 & LaTeX-insert-item \\
+    &&&&&&
+\end{tabular}
+
+\begin{tabular}[t]{*{3}{lc*{2}{l}} r}
+  1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & LaTeX-insert-item \\
+    &&&&&&&&&&&&
+\end{tabular}
+
+Standard LaTeX tabular*:
address@hidden@{}}
+  1 & 2 & 3 & LaTeX-insert-item \\
+    &&&
+\end{tabular*}
+
address@hidden|l}|r|}
+  1 & 2 & 3 & LaTeX-insert-item \\
+    &&&
+\end{tabular*}
+
+\end{document}

commit 1c9de7e71aa03fc333b1009fa74d10278f8068b5
Author: Arash Esbati <address@hidden>
Date:   Mon Dec 19 17:06:23 2016 +0100

    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.

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.

commit 3677ddcd6837c5b107d4a5d94059d487e928e082
Author: Arash Esbati <address@hidden>
Date:   Mon Dec 19 16:50:43 2016 +0100

    Add new style/dcolumn.el
    
    * Makefile.in (STYLESRC): Add new style.
    
    * style/dcolumn.el: New file.

diff --git a/Makefile.in b/Makefile.in
index 01adbac..c038460 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -158,7 +158,8 @@ STYLESRC = style/prosper.el \
           style/pdflscape.el style/commath.el   style/empheq.el \
           style/framed.el    style/paracol.el   style/menukeys.el \
           style/bidi.el      style/FiraMono.el  style/FiraSans.el \
-          style/bicaption.el style/amsfonts.el  style/subfiles.el
+          style/bicaption.el style/amsfonts.el  style/subfiles.el \
+          style/dcolumn.el
 
 STYLEELC = $(STYLESRC:.el=.elc)
 
diff --git a/style/dcolumn.el b/style/dcolumn.el
new file mode 100644
index 0000000..d013b0f
--- /dev/null
+++ b/style/dcolumn.el
@@ -0,0 +1,49 @@
+;;; dcolumn.el --- AUCTeX style for `dcolumn.sty' (v1.06)
+
+;; Copyright (C) 2016 Free Software Foundation, Inc.
+
+;; Author: Arash Esbati <arash.esbati'at'gmail.com>
+;; Maintainer: address@hidden
+;; Created: 2016-12-18
+;; Keywords: tex
+
+;; This file is part of AUCTeX.
+
+;; AUCTeX is free software; you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3, or (at your option)
+;; any later version.
+
+;; AUCTeX is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with AUCTeX; see the file COPYING.  If not, write to the Free
+;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+;; 02110-1301, USA.
+
+;;; Commentary:
+
+;; This file adds support for `dcolumn.sty' (v1.06) from 2014/10/28.
+;; `dcolumn.sty' is part of TeXLive.
+
+;;; Code:
+
+(TeX-add-style-hook
+ "dcolumn"
+ (lambda ()
+
+   ;; `dcolumn.sty' adds one new column specification letter:
+   (set (make-local-variable 'LaTeX-array-column-letters)
+       (concat LaTeX-array-column-letters "D"))
+
+   ;; Also run style hook for `array':
+   (TeX-run-style-hooks "array"))
+ LaTeX-dialect)
+
+(defvar LaTeX-dcolumn-package-options nil
+  "Package options for the dcolumn package.")
+
+;;; dcolumn.el ends here

commit 76db91e3b6426ca56a2be4e9089aa5c9994629d9
Author: Arash Esbati <address@hidden>
Date:   Mon Dec 19 16:46:14 2016 +0100

    Accept non-letter characters as column specifier
    
    * style/array.el (LaTeX-array-newcolumntype-regexp): Accept
    non-letter characters as column specifier.

diff --git a/style/array.el b/style/array.el
index 645371d..721e9de 100644
--- a/style/array.el
+++ b/style/array.el
@@ -34,7 +34,7 @@
 (TeX-auto-add-type "array-newcolumntype" "LaTeX")
 
 (defvar LaTeX-array-newcolumntype-regexp
-  '("\\\\newcolumntype{\\([a-zA-Z]+\\)}"
+  '("\\\\newcolumntype{\\([^}]+\\)}"
     1 LaTeX-auto-array-newcolumntype)
   "Matches the argument of `\\newcolumntype' from `array'
 package.")

-----------------------------------------------------------------------

Summary of changes:
 Makefile.in                                  |    3 +-
 doc/auctex.texi                              |    7 ++++-
 latex.el                                     |   29 ++++++++++++++---
 style/array.el                               |    2 +-
 style/{framed.el => dcolumn.el}              |   33 +++++++++-----------
 tests/latex/latex-test.el                    |   26 ++++++++++++++--
 tests/latex/tabular-count-ampersands-in.tex  |   36 +++++++++++++++++++++
 tests/latex/tabular-count-ampersands-out.tex |   43 ++++++++++++++++++++++++++
 8 files changed, 151 insertions(+), 28 deletions(-)
 copy style/{framed.el => dcolumn.el} (64%)
 create mode 100644 tests/latex/tabular-count-ampersands-in.tex
 create mode 100644 tests/latex/tabular-count-ampersands-out.tex


hooks/post-receive
-- 
GNU AUCTeX



reply via email to

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