From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Marcin Borkowski Newsgroups: gmane.emacs.bugs Subject: bug#21154: 24.5.50; LaTeX mode complains about mismatched parentheses on end commands Date: Fri, 06 May 2016 14:56:50 +0200 Message-ID: <87zis3cpkd.fsf@mbork.pl> References: <87h9oneqt0.fsf@ijmp.net> <87wpnfthtv.fsf@mbork.pl> <87pot4zr64.fsf@mbork.pl> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1462539521 15800 80.91.229.3 (6 May 2016 12:58:41 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 6 May 2016 12:58:41 +0000 (UTC) Cc: 21154@debbugs.gnu.org To: Jeff Clough Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri May 06 14:58:31 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ayfKw-0005Wm-LU for geb-bug-gnu-emacs@m.gmane.org; Fri, 06 May 2016 14:58:30 +0200 Original-Received: from localhost ([::1]:58110 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ayfKt-0001vB-1d for geb-bug-gnu-emacs@m.gmane.org; Fri, 06 May 2016 08:58:27 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48868) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ayfKi-0001gL-SH for bug-gnu-emacs@gnu.org; Fri, 06 May 2016 08:58:23 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ayfKW-0003E1-UH for bug-gnu-emacs@gnu.org; Fri, 06 May 2016 08:58:11 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:57125) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ayfKW-0003D3-QY for bug-gnu-emacs@gnu.org; Fri, 06 May 2016 08:58:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ayfKU-0006F0-8N for bug-gnu-emacs@gnu.org; Fri, 06 May 2016 08:58:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Marcin Borkowski Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 06 May 2016 12:58:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 21154 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 21154-submit@debbugs.gnu.org id=B21154.146253942923925 (code B ref 21154); Fri, 06 May 2016 12:58:02 +0000 Original-Received: (at 21154) by debbugs.gnu.org; 6 May 2016 12:57:09 +0000 Original-Received: from localhost ([127.0.0.1]:41229 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ayfJZ-0006Dj-Ne for submit@debbugs.gnu.org; Fri, 06 May 2016 08:57:09 -0400 Original-Received: from mail.mojserwer.eu ([195.110.48.8]:59326) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ayfJU-0006DG-5h for 21154@debbugs.gnu.org; Fri, 06 May 2016 08:57:04 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by mail.mojserwer.eu (Postfix) with ESMTP id 945FFB3F9AB; Fri, 6 May 2016 14:56:58 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mail.mojserwer.eu Original-Received: from mail.mojserwer.eu ([127.0.0.1]) by localhost (mail.mojserwer.eu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pOMPk+S7w8Cj; Fri, 6 May 2016 14:56:54 +0200 (CEST) Original-Received: from localhost (unknown [IPv6:2001:808:114:6:a288:b4ff:fe90:5e24]) by mail.mojserwer.eu (Postfix) with ESMTPSA id 4886FB3F9A9; Fri, 6 May 2016 14:56:54 +0200 (CEST) User-agent: mu4e 0.9.13; emacs 25.1.50.9 In-reply-to: <87pot4zr64.fsf@mbork.pl> 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: 208.118.235.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:117907 Archived-At: On 2016-05-02, at 12:32, Marcin Borkowski wrote: > On 2016-04-30, at 14:13, Marcin Borkowski wrote: > >> On 2015-07-28, at 20:43, Jeff Clough wrote: >> >>> When writing LaTeX, typing the closing curly brace of an end >>> command (\end{document} for instance) causes a "Mismatched parentheses" >>> complaint to appear in the minibuffer, even when this seems to be false. >>> >>> Steps to reproduce: >>> >>> Create a new ".tex" file with the following contents (note the missing >>> curly brace at the very end... >>> >>> \documentclass{article} >>> \begin{document} >>> \end{document >>> >>> Watch the minibuffer, type the closing curly brace, and witness the >>> complaint. The only ever appears to happen on an end command, and it >>> happens on every single end command no matter where it appears. >> >> Confirmed on GNU Emacs 25.1.50.9 (commit a3b46e0). I'll try to >> investigate it. > > Here's my conjecture: the problematic message is displayed by > `blink-matching-open'. After cursory examination, it seems that the > problem is caused by the fact that `forward-sexp-function' in tex-mode > is trying to be smart and jumps to the beginning of the environment when > after "\end{...}". Since there is no opening brace there, > `blink-matching-open' thinks there's a mismatch. > > I'll try to come up with a patch. > > Incidentally, AUC-TeX does not have this problem. OK, so it seems a tad harder than I thought. I mean, making a patch that works is easy; making a patch that works _and_ doesn't break anything else may be slightly tricky. My proposal is to temporarily bind `forward-sexp-function' to nil in `blink-matching-open' so that it finds the opening brace correctly. (Effectively, making `forward-sexp' fall back to `scan-sexps'.) Could anyone imagine a situation where this would break something? There doesn't seem to exist a lot of modes in core Emacs which set `forward-sexp-function' to a non-nil value, so I may just look at all occurences of that variable in the codebase if that is reasonable. Best, -- Marcin Borkowski http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski Faculty of Mathematics and Computer Science Adam Mickiewicz University