GNU bug report logs - #38152
tex-mode: paragraph separator groups text and comments

Previous Next

Package: emacs;

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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 38152 in the body.
You can then email your comments to 38152 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#38152; Package emacs. (Sat, 09 Nov 2019 14:30:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Michael Orlitzky <michael <at> orlitzky.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 09 Nov 2019 14:30:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Michael Orlitzky <michael <at> orlitzky.com>
To: bug-gnu-emacs <at> gnu.org
Subject: tex-mode: paragraph separator groups text and comments
Date: Sat, 9 Nov 2019 09:29:12 -0500
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]*\\($\\|"
 		"\\\\[][]\\|"




Added tag(s) patch. Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Tue, 12 Nov 2019 01:27:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38152; Package emacs. (Sat, 16 Nov 2019 07:17:02 GMT) Full text and rfc822 format available.

Message #10 received at 38152 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Michael Orlitzky <michael <at> orlitzky.com>
Cc: 38152 <at> debbugs.gnu.org
Subject: Re: bug#38152: tex-mode: paragraph separator groups text and comments
Date: Sat, 16 Nov 2019 08:16:47 +0100
Michael Orlitzky <michael <at> 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




Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 16 Nov 2019 07:18:01 GMT) Full text and rfc822 format available.

bug marked as fixed in version 27.1, send any further explanations to 38152 <at> debbugs.gnu.org and Michael Orlitzky <michael <at> orlitzky.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 16 Nov 2019 07:18:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 14 Dec 2019 12:24:05 GMT) Full text and rfc822 format available.

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.