From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Michael Orlitzky Newsgroups: gmane.emacs.bugs Subject: bug#38152: tex-mode: paragraph separator groups text and comments Date: Sat, 9 Nov 2019 09:29:12 -0500 Message-ID: <1c676915-8d09-34d4-36e6-ef29cb6ef8b5@orlitzky.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="18801"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.0 To: 38152@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Nov 09 15:30:15 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iTRki-0004iC-EL for geb-bug-gnu-emacs@m.gmane.org; Sat, 09 Nov 2019 15:30:12 +0100 Original-Received: from localhost ([::1]:37048 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iTRkh-0000Rq-1z for geb-bug-gnu-emacs@m.gmane.org; Sat, 09 Nov 2019 09:30:11 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41860) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iTRka-0000RW-8t for bug-gnu-emacs@gnu.org; Sat, 09 Nov 2019 09:30:05 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iTRkZ-00076n-3f for bug-gnu-emacs@gnu.org; Sat, 09 Nov 2019 09:30:04 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:39547) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iTRkZ-00076h-0a for bug-gnu-emacs@gnu.org; Sat, 09 Nov 2019 09:30:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iTRkY-00006y-QK for bug-gnu-emacs@gnu.org; Sat, 09 Nov 2019 09:30:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Michael Orlitzky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 09 Nov 2019 14:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 38152 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.1573309757323 (code B ref -1); Sat, 09 Nov 2019 14:30:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 9 Nov 2019 14:29:17 +0000 Original-Received: from localhost ([127.0.0.1]:48368 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iTRjo-000058-QF for submit@debbugs.gnu.org; Sat, 09 Nov 2019 09:29:17 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:50587) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iTRjj-0008WV-00 for submit@debbugs.gnu.org; Sat, 09 Nov 2019 09:29:11 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41826) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iTRjh-0000GL-O0 for bug-gnu-emacs@gnu.org; Sat, 09 Nov 2019 09:29:10 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iTRjf-0006dz-8P for bug-gnu-emacs@gnu.org; Sat, 09 Nov 2019 09:29:08 -0500 Original-Received: from mail2.viabit.com ([65.246.80.16]:52254) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iTRjf-0006da-3K for bug-gnu-emacs@gnu.org; Sat, 09 Nov 2019 09:29:07 -0500 Original-Received: from [172.17.29.8] (vpn1.metro-data.com [65.213.236.242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail2.viabit.com (Postfix) with ESMTPSA id 479KJf1jDCz4057 for ; Sat, 9 Nov 2019 09:29:05 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=orlitzky.com; s=mail2; t=1573309746; bh=nsqCfZ1cWtxyw8bML4QXG+QbV6m1rNia1EU3tHKWwsM=; h=To:From:Subject:Date; b=Hzys3LX//eJ/939ZyV5mpKj5KcdWM05n7VL+7W/o3RUhjpgnzBhiv92qK8om7pfLK B9Nm3foeOQ4iZd1ZRvD6oohUlBM42MDGLeAokI6Dm2NZDBHnnoe+e7TywyzvYA5XCH qwl177dmRiWs8Fw75rZSaF2py3BbSoOyJd0IaH8o= Content-Language: en-US X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:171324 Archived-At: 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]*\\($\\|" "\\\\[][]\\|"