[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[AUCTeX-diffs] [elpa] externals/auctex 98455d0 6/8: Give explicit arg to
From: |
Tassilo Horn |
Subject: |
[AUCTeX-diffs] [elpa] externals/auctex 98455d0 6/8: Give explicit arg to LaTeX-back-to-indentation in filling functions. |
Date: |
Sun, 25 Apr 2021 15:22:51 -0400 (EDT) |
branch: externals/auctex
commit 98455d05f0acf1630dea7a18f5f0b360323c58f1
Author: Tassilo Horn <tsdh@gnu.org>
Commit: Tassilo Horn <tsdh@gnu.org>
Give explicit arg to LaTeX-back-to-indentation in filling functions.
Also add some comment filling tests, and adapt one existing test to
new filling behavior introduced in previous commit.
* latex.el (LaTeX-fill-region-as-para-do):
(LaTeX-fill-move-to-break-point): Provide explicit arg to
`LaTeX-back-to-indentation'.
---
latex.el | 6 ++---
tests/latex/latex-comment-filling-in.tex | 35 ++++++++++++++++++++++++++
tests/latex/latex-comment-filling-out.tex | 38 ++++++++++++++++++++++++++++
tests/latex/latex-test.el | 41 ++++++++++++++++++++++---------
4 files changed, 105 insertions(+), 15 deletions(-)
diff --git a/latex.el b/latex.el
index beaa0dd..1feafd1 100644
--- a/latex.el
+++ b/latex.el
@@ -3929,7 +3929,7 @@ space does not end a sentence, so don't break a line
there."
(goto-char from)
(let* (linebeg
(code-comment-start (save-excursion
- (LaTeX-back-to-indentation)
+ (LaTeX-back-to-indentation 'inner)
(TeX-search-forward-comment-start
(line-end-position))))
(end-marker (save-excursion
@@ -4040,7 +4040,7 @@ space does not end a sentence, so don't break a line
there."
(TeX-looking-at-backward (concat (regexp-quote TeX-esc)
TeX-token-char "*")
(1- (- (point) linebeg)))
(not (TeX-escaped-p (match-beginning 0))))
- (goto-char (match-beginning 0)))
+ (goto-char (match-beginning 0)))
;; Cater for \verb|...| (and similar) contructs which should not be
;; broken. (FIXME: Make it work with shortvrb.sty (also loaded by
;; doc.sty) where |...| is allowed. Arbitrary delimiters may be
@@ -4081,7 +4081,7 @@ space does not end a sentence, so don't break a line
there."
start-point)
(save-excursion
(beginning-of-line)
- (LaTeX-back-to-indentation)
+ (LaTeX-back-to-indentation 'outer)
(setq start-point (point))
;; Find occurences of [, $, {, }, \(, \), \[, \] or $$.
(while (and (= final-breakpoint orig-breakpoint)
diff --git a/tests/latex/latex-comment-filling-in.tex
b/tests/latex/latex-comment-filling-in.tex
new file mode 100644
index 0000000..1ba1bb8
--- /dev/null
+++ b/tests/latex/latex-comment-filling-in.tex
@@ -0,0 +1,35 @@
+% This is a very long comment which should be wrapped around after fill-column
characters. We'll see if that works.
+
+% \begin{itemize}
+% \item This is a long item text which should be wrapped around after
fill-column characters even though it is commented.
+% \item This is short.
+% This also.
+% So all 3 gonna be joined.
+% \end{itemize}
+
+\begin{quote}
+ % This is a very long comment which should be wrapped around after
fill-column characters. We'll see if that works.
+\end{quote}
+
+\begin{quote}
+ % \begin{itemize}
+ % \item This is a long item text which should be wrapped around after
fill-column characters even though it is commented. This should still work
although we're already indented.
+ % \item This is short.
+ % This also.
+ % So all 3 gonna be joined.
+ % \end{itemize}
+\end{quote}
+
+% This is short.\\
+% But no join because the backslashes.
+
+% This is short.\par
+% But no join because the par.
+
+% Code comments.
+
+\foo\bar % This is a code comment.
+\baz % This also.
+\quux % So lines must not be joined.
+\foobar % But very long lines, such as this one, well, you know, they may be
wrapped around. TODO: It would be cool if this was indented as much as the
previous line.
+\bar % This is short.
diff --git a/tests/latex/latex-comment-filling-out.tex
b/tests/latex/latex-comment-filling-out.tex
new file mode 100644
index 0000000..0917d95
--- /dev/null
+++ b/tests/latex/latex-comment-filling-out.tex
@@ -0,0 +1,38 @@
+% This is a very long comment which should be wrapped around after
+% fill-column characters. We'll see if that works.
+
+% \begin{itemize}
+% \item This is a long item text which should be wrapped around after
+% fill-column characters even though it is commented.
+% \item This is short. This also. So all 3 gonna be joined.
+% \end{itemize}
+
+\begin{quote}
+ % This is a very long comment which should be wrapped around after
+ % fill-column characters. We'll see if that works.
+\end{quote}
+
+\begin{quote}
+ % \begin{itemize}
+ % \item This is a long item text which should be wrapped around
+ % after fill-column characters even though it is commented. This
+ % should still work although we're already indented.
+ % \item This is short. This also. So all 3 gonna be joined.
+ % \end{itemize}
+\end{quote}
+
+% This is short.\\
+% But no join because the backslashes.
+
+% This is short.\par
+% But no join because the par.
+
+% Code comments.
+
+\foo\bar % This is a code comment.
+\baz % This also.
+\quux % So lines must not be joined.
+\foobar % But very long lines, such as this one, well, you know, they
+% may be wrapped around. TODO: It would be cool if this was indented
+% as much as the previous line.
+\bar % This is short.
diff --git a/tests/latex/latex-test.el b/tests/latex/latex-test.el
index 81cfc52..af6e34f 100644
--- a/tests/latex/latex-test.el
+++ b/tests/latex/latex-test.el
@@ -33,6 +33,10 @@
"latex-filling-in.tex"
'LaTeX-filling/out
"latex-filling-out.tex"
+ 'LaTeX-comment-filling/in
+ "latex-comment-filling-in.tex"
+ 'LaTeX-comment-filling/out
+ "latex-comment-filling-out.tex"
'LaTeX-math-indent/in
"math-indent-in.tex"
'LaTeX-math-indent/out
@@ -96,6 +100,27 @@
(insert-file-contents LaTeX-filling/out)
(buffer-string)))))
+;; Test for comment filling, especially with
+;; `LaTeX-syntactic-comments' which is t by default.
+(ert-deftest LaTeX-comment-filling ()
+ (should (string=
+ (with-temp-buffer
+ (insert-file-contents LaTeX-comment-filling/in)
+ (LaTeX-mode)
+ (let ((fill-column 70)
+ (code-comment-test nil))
+ (fill-paragraph)
+ (while (= 0 (forward-line 1))
+ (when (looking-at "% Code comments.")
+ (setq code-comment-test t))
+ (when code-comment-test
+ (LaTeX-back-to-indentation 'inner))
+ (fill-paragraph)))
+ (buffer-string))
+ (with-temp-buffer
+ (insert-file-contents LaTeX-comment-filling/out)
+ (buffer-string)))))
+
;; Test for bug#19281 (https://debbugs.gnu.org/cgi/bugreport.cgi?bug=19281):
;; make sure AUCTeX is able to insert and modify an environment containing a
;; TeX-esc and braces in its name.
@@ -453,9 +478,7 @@ ghi"))
(buffer-string)
"\\begin{quote}
% \\begin{center}
- % abc
- % def
- % ghi
+ % abc def ghi
% \\end{center}
\\end{quote}
"))
@@ -478,9 +501,7 @@ ghi"))
(buffer-string)
"\\begin{quote}
% \\begin{center}
- % abc
- % def
- % ghi
+ % abc def ghi
% \\end{center}
\\end{quote}
"))
@@ -504,9 +525,7 @@ ghi"))
(buffer-string)
"\\begin{quote}
% \\begin{center}
- % abc
- % def
- % ghi
+ % abc def ghi
% \\end{center}
\\end{quote}
"))
@@ -529,9 +548,7 @@ ghi"))
(buffer-string)
"\\begin{quote}
\\begin{center}
- % abc
- % def
- % ghi
+ % abc def ghi
\\end{center}
\\end{quote}
")))))
- [AUCTeX-diffs] [elpa] externals/auctex updated (0383415 -> 3c4c78b), Tassilo Horn, 2021/04/25
- [AUCTeX-diffs] [elpa] externals/auctex b641204 1/8: Improve handling for parentheses with electric-pair-mode (bug#47936), Tassilo Horn, 2021/04/25
- [AUCTeX-diffs] [elpa] externals/auctex 98455d0 6/8: Give explicit arg to LaTeX-back-to-indentation in filling functions.,
Tassilo Horn <=
- [AUCTeX-diffs] [elpa] externals/auctex 40b9319 7/8: Fix matching of script chars (bug#48012), Tassilo Horn, 2021/04/25
- [AUCTeX-diffs] [elpa] externals/auctex 93363d3 3/8: Follow up previous commit, Tassilo Horn, 2021/04/25
- [AUCTeX-diffs] [elpa] externals/auctex d1d99ae 2/8: Get rid of unexpected side effects, Tassilo Horn, 2021/04/25
- [AUCTeX-diffs] [elpa] externals/auctex 3d813cd 4/8: Add new test, Tassilo Horn, 2021/04/25
- [AUCTeX-diffs] [elpa] externals/auctex 6d3ecf3 5/8: Don't treat comments with whitespace before % as code comments, Tassilo Horn, 2021/04/25
- [AUCTeX-diffs] [elpa] externals/auctex 3c4c78b 8/8: Merge remote-tracking branch 'origin/master' into externals/auctex, Tassilo Horn, 2021/04/25