Re: [AUCTeX-devel] Extending `LaTeX-array-count-columns'

2016-12-19 Thread Ikumi Keita
Hi Arash and all,

> Following up myself, I did some more testing with your code and it
> worked like a charm and since there was no objections, I pushed the code
> incl. a test case and an update to the docs to git.  I added a style for
> dcolumn.sty and also fixed a bug in array.el.

> Again, thank you for taking your time.

You're welcome.  I just followed a way you opened.  If you hadn't tried
to support *-operator, I had thought that it was too difficult to
implement.  I'm glad that my work serves you and all.

Regards,
Ikumi Keita

___
auctex-devel mailing list
auctex-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/auctex-devel


Re: [AUCTeX-devel] Extending `LaTeX-array-count-columns'

2016-12-19 Thread Arash Esbati
Hi Ikumi and all,

Arash Esbati  writes:

> Ikumi Keita  writes:
>>
>> Apparently recursive call of LaTeX-array-count-columns is needed do the
>> task.  How about this one?
>> [...]
>
> Thanks!  I'm fine with your suggestions.  I have already pushed some
> patches to git for other styles.  Once we have this function sorted out,
> I would add some additional tests (see my other message to Mosè) and
> update latex.el.  Then `M-RET' should work for all tabular env's.

Following up myself, I did some more testing with your code and it
worked like a charm and since there was no objections, I pushed the code
incl. a test case and an update to the docs to git.  I added a style for
dcolumn.sty and also fixed a bug in array.el.

Again, thank you for taking your time.

Best, Arash

___
auctex-devel mailing list
auctex-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/auctex-devel


[AUCTeX-commit] GNU AUCTeX branch, master, updated. 7518a8a3ae1a85bebd5aa7a9f16e9c36317c150e

2016-12-19 Thread Arash Esbati
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 
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.

commit 66ed2ac0732d0a0af1045091fb24535ac5d3bdbf
Author: Arash Esbati 
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'.

commit 1c9de7e71aa03fc333b1009fa74d10278f8068b5
Author: Arash Esbati 
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.

commit 3677ddcd6837c5b107d4a5d94059d487e928e082
Author: Arash Esbati 
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.

commit 76db91e3b6426ca56a2be4e9089aa5c9994629d9
Author: Arash Esbati 
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.

---

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

___
auctex-commit mailing list
auctex-com...@gnu.org
https://lists.gnu.org/mailman/listinfo/auctex-commit


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

2016-12-19 Thread Arash Esbati
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 
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 @samp{*@{num@}@{cols@}} 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 
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 000..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]{}
+  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 &