[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/auctex 991b582 50/95: Detect \& in tabular cells when f
From: |
Tassilo Horn |
Subject: |
[elpa] externals/auctex 991b582 50/95: Detect \& in tabular cells when filling |
Date: |
Sun, 16 Apr 2017 01:26:53 -0400 (EDT) |
branch: externals/auctex
commit 991b582e7e27bc9e1b28415da32980e93eb0eca5
Author: Arash Esbati <address@hidden>
Commit: Arash Esbati <address@hidden>
Detect \& in tabular cells when filling
* latex.el (LaTeX-indent-tabular): Search backward for any
ampersands not escaped with a backslash, i.e. control symbol \&,
and return the adjusted value. Thanks to Ikumi Keita for his
perceptive comments on the implementation. (bug#26010)
* tests/latex/tabular-in.tex:
* tests/latex/tabular-out.tex: Add test for table filling with \&
in cells.
---
latex.el | 6 +++---
tests/latex/latex-test.el | 2 ++
tests/latex/tabular-in.tex | 15 +++++++++++++++
tests/latex/tabular-out.tex | 15 +++++++++++++++
4 files changed, 35 insertions(+), 3 deletions(-)
diff --git a/latex.el b/latex.el
index 318362f..f034207 100644
--- a/latex.el
+++ b/latex.el
@@ -6664,10 +6664,10 @@ function would return non-nil and `(match-string 1)'
would return
(t
(+ 2
(let ((any-col (save-excursion
- (when (re-search-backward "\\\\\\\\\\|&"
beg-pos t)
+ (when (re-search-backward "\\\\\\\\\\|[^\\]&"
beg-pos t)
(current-column)))))
- (if (and any-col (string= "&" (match-string 0)))
- any-col
+ (if (and any-col (= ?& (char-before (match-end 0))))
+ (1+ any-col)
beg-col))))))))
(provide 'latex)
diff --git a/tests/latex/latex-test.el b/tests/latex/latex-test.el
index 205af00..e6e70eb 100644
--- a/tests/latex/latex-test.el
+++ b/tests/latex/latex-test.el
@@ -61,6 +61,8 @@ line and from another directory."
'tabular-count-ampersands/out
"tabular-count-ampersands-out.tex")
+;; Test for detecting \& in a table cell added; see
+;; https://debbugs.gnu.org/cgi/bugreport.cgi?bug=26010
(ert-deftest LaTeX-indent-tabular ()
(should (string=
(with-temp-buffer
diff --git a/tests/latex/tabular-in.tex b/tests/latex/tabular-in.tex
index a8be333..61c0a92 100644
--- a/tests/latex/tabular-in.tex
+++ b/tests/latex/tabular-in.tex
@@ -38,4 +38,19 @@ detraxit & no. & Ne sea doming & deserunt.
8 &
9
\end{align}
+
+% Next table tests filling with a control symbol \& inside a cell; the
+% function `LaTeX-indent-tabular' now (March 2017) detects \&, see:
+% https://debbugs.gnu.org/cgi/bugreport.cgi?bug=26010
+\begin{tabular}{llll}
+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{document}
diff --git a/tests/latex/tabular-out.tex b/tests/latex/tabular-out.tex
index cd5b708..9310b0a 100644
--- a/tests/latex/tabular-out.tex
+++ b/tests/latex/tabular-out.tex
@@ -38,4 +38,19 @@
8 &
9
\end{align}
+
+% Next table tests filling with a control symbol \& inside a cell; the
+% function `LaTeX-indent-tabular' now (March 2017) detects \&, see:
+% https://debbugs.gnu.org/cgi/bugreport.cgi?bug=26010
+\begin{tabular}{llll}
+ 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{document}
- [elpa] externals/auctex a49aaa4 44/95: Fix font-latex-make-match-defun to generate intended code., (continued)
- [elpa] externals/auctex a49aaa4 44/95: Fix font-latex-make-match-defun to generate intended code., Tassilo Horn, 2017/04/16
- [elpa] externals/auctex 664186d 52/95: ; Add fix related with coding system missing in my commit on Feb 14., Tassilo Horn, 2017/04/16
- [elpa] externals/auctex 7c48c19 49/95: * tex-ispell.el (TeX-ispell-skip-cmds-list): Add hyperref macros., Tassilo Horn, 2017/04/16
- [elpa] externals/auctex 4054384 25/95: Fix parsing bug in style/xcolor.el, Tassilo Horn, 2017/04/16
- [elpa] externals/auctex b4f304b 36/95: Improve regexp for looking for documentclass macro, Tassilo Horn, 2017/04/16
- [elpa] externals/auctex 9876030 23/95: Fix minor problems, Tassilo Horn, 2017/04/16
- [elpa] externals/auctex 586cbd8 28/95: * .gitignore: Ignore only preview.el in top directory., Tassilo Horn, 2017/04/16
- [elpa] externals/auctex cf43d7d 53/95: ; Add some full stops at the end of sentences of the manual, Tassilo Horn, 2017/04/16
- [elpa] externals/auctex de5e40b 37/95: Fix setting of coding system for Japanese TeX, Tassilo Horn, 2017/04/16
- [elpa] externals/auctex 7e7e55e 40/95: Add new style/sourcecodepro.el, Tassilo Horn, 2017/04/16
- [elpa] externals/auctex 991b582 50/95: Detect \& in tabular cells when filling,
Tassilo Horn <=
- [elpa] externals/auctex 4fcee32 68/95: Use the variable `LaTeX-listing-label', Tassilo Horn, 2017/04/16
- [elpa] externals/auctex 77974e6 71/95: * style/minted.el ("minted"): Add key=val query for \mint and \mintinline., Tassilo Horn, 2017/04/16
- [elpa] externals/auctex 43b07d9 70/95: Use `TeX-line-number-at-pos' further for older emacsen, Tassilo Horn, 2017/04/16
- [elpa] externals/auctex 9e7f21e 69/95: Use compatibility function `TeX-line-number-at-pos' for older emacsen, Tassilo Horn, 2017/04/16
- [elpa] externals/auctex c360b9a 76/95: Adapt fontification for \lstinline, Tassilo Horn, 2017/04/16
- [elpa] externals/auctex 2182b6f 30/95: Append "lstlisting" to `LaTeX-label-alist', Tassilo Horn, 2017/04/16
- [elpa] externals/auctex 337ce76 33/95: Add new keys for package version 4.00, Tassilo Horn, 2017/04/16
- [elpa] externals/auctex 6bb49cc 39/95: * style/subfiles.el (LaTeX-subfiles-class-options): New function., Tassilo Horn, 2017/04/16
- [elpa] externals/auctex 4992f5a 46/95: Make customization to face specification to appear in, Tassilo Horn, 2017/04/16
- [elpa] externals/auctex c97a654 48/95: * tex-ispell.el (TeX-ispell-skip-setcdr): Add entry for filecontents package., Tassilo Horn, 2017/04/16