* bug#38152: tex-mode: paragraph separator groups text and comments
@ 2019-11-09 14:29 Michael Orlitzky
2019-11-16 7:16 ` Lars Ingebrigtsen
0 siblings, 1 reply; 2+ messages in thread
From: Michael Orlitzky @ 2019-11-09 14:29 UTC (permalink / raw)
To: 38152
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]*\\($\\|"
"\\\\[][]\\|"
^ permalink raw reply [flat|nested] 2+ messages in thread
* bug#38152: tex-mode: paragraph separator groups text and comments
2019-11-09 14:29 bug#38152: tex-mode: paragraph separator groups text and comments Michael Orlitzky
@ 2019-11-16 7:16 ` Lars Ingebrigtsen
0 siblings, 0 replies; 2+ messages in thread
From: Lars Ingebrigtsen @ 2019-11-16 7:16 UTC (permalink / raw)
To: Michael Orlitzky; +Cc: 38152
Michael Orlitzky <michael@orlitzky.com> writes:
> 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:
Thanks; the patch fixes the issue in the example provided, at least (and
it seems logical to me), so I've applied it to Emacs 27.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-11-16 7:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-11-09 14:29 bug#38152: tex-mode: paragraph separator groups text and comments Michael Orlitzky
2019-11-16 7:16 ` Lars Ingebrigtsen
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.