[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/auctex 6b5a7e0 56/95: Improve fallback for indentation
From: |
Tassilo Horn |
Subject: |
[elpa] externals/auctex 6b5a7e0 56/95: Improve fallback for indentation when & is omitted |
Date: |
Sun, 16 Apr 2017 01:26:54 -0400 (EDT) |
branch: externals/auctex
commit 6b5a7e0d058c41763a09c8c292b33cc6b18616ce
Author: Arash Esbati <address@hidden>
Commit: Arash Esbati <address@hidden>
Improve fallback for indentation when & is omitted
* latex.el (LaTeX-hanging-ampersand-position): Improve handling of
fallback which now respects also intended tabular environments.
Thanks to Ikumi Keita for testing and providing code. (bug#26032)
* tests/latex/tabular-in.tex:
* tests/latex/tabular-out.tex: Add additional test for indented
tabular.
---
latex.el | 8 +++-----
tests/latex/tabular-in.tex | 20 ++++++++++++++++----
tests/latex/tabular-out.tex | 20 ++++++++++++++++----
3 files changed, 35 insertions(+), 13 deletions(-)
diff --git a/latex.el b/latex.el
index d91d9c9..443396f 100644
--- a/latex.el
+++ b/latex.el
@@ -6638,11 +6638,9 @@ function would return non-nil and `(match-string 1)'
would return
(re-search-forward "[^\\]&" cur-pos t (+ 1 cur-idx))
;; If the above searchs fails, i.e. no "&" found,
;; (- (current-column) 1) returns -1, which is wrong. So
- ;; we check the result first with `natnump' and return
- ;; (+ 2 beg-col) as fallback.
- (if (natnump (- (current-column) 1))
- (- (current-column) 1)
- (+ 2 beg-col)))
+ ;; we use a fallback (+ 2 beg-col) whenever this happens:
+ (max (- (current-column) 1)
+ (+ 2 beg-col)))
(+ 2 beg-col))))))
(defun LaTeX-indent-tabular ()
diff --git a/tests/latex/tabular-in.tex b/tests/latex/tabular-in.tex
index a0b9bf0..8f75ab7 100644
--- a/tests/latex/tabular-in.tex
+++ b/tests/latex/tabular-in.tex
@@ -53,12 +53,12 @@ prompta & disputando & ne mel, ne
vel. & No petentium
\end{tabular}
-% Next table tests filling when & (column separator) character is
-% missing in a row; the function `LaTeX-hanging-ampersand-position' now
-% (March 2017) detects this and has a fallback, see:
+% Next tables test filling when & (column separator) character is
+% missing in a row; the function `LaTeX-hanging-ampersand-position'
+% now (March 2017) detects this and has a fallback, see:
% https://debbugs.gnu.org/cgi/bugreport.cgi?bug=26032
\begin{tabular}{llll}
-\multicolumn{4}{c}{Lorem ipsum dolor sit amet, ei mei}\\
+\multicolumn{4}{c}{Lorem ipsum dolor sit amet, ei mei} \\
& paulo tation honestatis,
intellegam accommodare ne vim, ut \\
& mel solum putant atomorum. Posse & dolores has ut, \\
@@ -67,4 +67,16 @@ prompta & disputando & ne mel, ne
& No petentium
\end{tabular}
+\begin{table}[tbp]
+ \begin{tabular}{llll}
+\multicolumn{4}{c}{Lorem ipsum dolor sit amet, ei mei} \\
+& paulo tation honestatis,
+intellegam accommodare ne vim, ut \\
+& mel solum putant atomorum. Posse & dolores has ut, \\
+prompta & disputando & ne mel, ne
+\& viderer ceteros vel. \\
+& No petentium
+ \end{tabular}
+\end{table}
+
\end{document}
diff --git a/tests/latex/tabular-out.tex b/tests/latex/tabular-out.tex
index 316ee99..73521d2 100644
--- a/tests/latex/tabular-out.tex
+++ b/tests/latex/tabular-out.tex
@@ -53,12 +53,12 @@
vel. & No petentium
\end{tabular}
-% Next table tests filling when & (column separator) character is
-% missing in a row; the function `LaTeX-hanging-ampersand-position' now
-% (March 2017) detects this and has a fallback, see:
+% Next tables test filling when & (column separator) character is
+% missing in a row; the function `LaTeX-hanging-ampersand-position'
+% now (March 2017) detects this and has a fallback, see:
% https://debbugs.gnu.org/cgi/bugreport.cgi?bug=26032
\begin{tabular}{llll}
- \multicolumn{4}{c}{Lorem ipsum dolor sit amet, ei mei}\\
+ \multicolumn{4}{c}{Lorem ipsum dolor sit amet, ei mei} \\
& paulo tation honestatis,
intellegam accommodare ne vim, ut \\
& mel solum putant atomorum. Posse & dolores has ut, \\
@@ -67,4 +67,16 @@
& No petentium
\end{tabular}
+\begin{table}[tbp]
+ \begin{tabular}{llll}
+ \multicolumn{4}{c}{Lorem ipsum dolor sit amet, ei mei} \\
+ & paulo tation honestatis,
+ intellegam accommodare ne vim, ut \\
+ & mel solum putant atomorum. Posse & dolores has ut, \\
+ prompta & disputando & ne mel, ne
+ \& viderer ceteros vel. \\
+ & No petentium
+ \end{tabular}
+\end{table}
+
\end{document}
- [elpa] externals/auctex 7390999 61/95: ; Simplify insertion of a newline after label, (continued)
- [elpa] externals/auctex 7390999 61/95: ; Simplify insertion of a newline after label, Tassilo Horn, 2017/04/16
- [elpa] externals/auctex 6a298a8 47/95: Fix documents and add trivial improvements., Tassilo Horn, 2017/04/16
- [elpa] externals/auctex a286e8b 57/95: Improve parsing capabilities of style/fancyvrb.el, Tassilo Horn, 2017/04/16
- [elpa] externals/auctex 11e234b 55/95: Remove spurious entries of view settings., Tassilo Horn, 2017/04/16
- [elpa] externals/auctex 83a875b 83/95: ; * tex.el (TeX-ispell-tex-arg-verb-end): Drop unnecessary `format'., Tassilo Horn, 2017/04/16
- [elpa] externals/auctex 2116248 94/95: * doc/changes.texi: Update with recent changes., Tassilo Horn, 2017/04/16
- [elpa] externals/auctex 65e56e1 93/95: ; Make sure that `regex-opt' builds a shy group., Tassilo Horn, 2017/04/16
- [elpa] externals/auctex e6c95e9 78/95: * tests/latex/fontification-verb-macros.tex: New file., Tassilo Horn, 2017/04/16
- [elpa] externals/auctex a8dba19 60/95: Fix addition of key=val's, Tassilo Horn, 2017/04/16
- [elpa] externals/auctex 4688310 65/95: Add new compat function `TeX-replace-regexp-in-string', Tassilo Horn, 2017/04/16
- [elpa] externals/auctex 6b5a7e0 56/95: Improve fallback for indentation when & is omitted,
Tassilo Horn <=
- [elpa] externals/auctex 592297d 64/95: Avoid altering user option as much as possible, Tassilo Horn, 2017/04/16
- [elpa] externals/auctex 7a382d2 72/95: * texmathp.el (texmathp-tex-commands-default): Add entries for empheq.sty., Tassilo Horn, 2017/04/16
- [elpa] externals/auctex 2fef12e 80/95: ; Clear out byte compile warning, Tassilo Horn, 2017/04/16
- [elpa] externals/auctex 51d8d3d 75/95: Recognize optional argument in verb macros with delimiters/braces, Tassilo Horn, 2017/04/16
- [elpa] externals/auctex d5951e6 79/95: Improve skipping of inline verbatim macros, Tassilo Horn, 2017/04/16
- [elpa] externals/auctex a45821b 92/95: ; * latex.el (LaTeX-section-list-add-locally): Fix doc string., Tassilo Horn, 2017/04/16
- [elpa] externals/auctex d82f66c 91/95: ; * style/paracol.el (TeX-arg-paracol-switchcolumn*): Guard point movement., Tassilo Horn, 2017/04/16
- [elpa] externals/auctex b2f69e1 84/95: Fix detection of bibliography files with dots in path, Tassilo Horn, 2017/04/16
- [elpa] externals/auctex ee42d37 73/95: Enhance Japanese class files support, Tassilo Horn, 2017/04/16
- [elpa] externals/auctex 334da3d 95/95: Merge branch 'master' into externals/auctex, Tassilo Horn, 2017/04/16