GNU bug report logs -
#38152
tex-mode: paragraph separator groups text and comments
Previous Next
Reported by: Michael Orlitzky <michael <at> orlitzky.com>
Date: Sat, 9 Nov 2019 14:30:02 UTC
Severity: normal
Tags: fixed, patch
Fixed in version 27.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
When using M-q (fill-paragraph) in latex-mode from tex-mode.el, emacs
will incorrectly wrap text into a comment block that precedes it. This
is fairly annoying, because it can silently "delete" a huge chunk of
your document, and leave you standing in front of a class wondering
where your theorem went.
This was partially addressed in bug 5821,
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=5821
but only for comments that start at the beginning of a line. A minimal
reproducer follows, and the indentation is significant:
\begin{document}
% This is a comment.
This line won't wrap into it.
% This is also a comment.
But this line will wrap into it.
\end{document}
This is the same problem that a stack overflow user reported,
https://tex.stackexchange.com/questions/131774
and is perhaps also related to bug 23249,
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=23249
which is about marking paragraphs adjacent to comments.
I don't claim that it's the correct fix for the issue, but the following
patch helps the small test case above, and at least confirms that the
paragraph separator has something to do with it:
--- a/tex-mode.el 2019-01-07 09:26:07.000000000 -0500
+++ b/tex-mode.el 2019-11-09 08:42:56.649424361 -0500
@@ -1155,7 +1155,7 @@
"\\>\\|\\\\[a-z]*" (regexp-opt '("space" "skip" "page") t)
"\\>\\)"))
(setq paragraph-separate
- (concat "[\f%]\\|[ \t]*\\($\\|"
+ (concat "\\([ \t]*%\\)\\|[\f]\\|[ \t]*\\($\\|"
"\\\\[][]\\|"
This bug report was last modified 5 years and 193 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.