unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Marcin Borkowski <mbork@mbork.pl>
To: Jeff Clough <jvc@ijmp.net>
Cc: 21154@debbugs.gnu.org
Subject: bug#21154: 24.5.50; LaTeX mode complains about mismatched parentheses on end commands
Date: Fri, 06 May 2016 14:56:50 +0200	[thread overview]
Message-ID: <87zis3cpkd.fsf@mbork.pl> (raw)
In-Reply-To: <87pot4zr64.fsf@mbork.pl>


On 2016-05-02, at 12:32, Marcin Borkowski <mbork@mbork.pl> wrote:

> On 2016-04-30, at 14:13, Marcin Borkowski <mbork@mbork.pl> wrote:
>
>> On 2015-07-28, at 20:43, Jeff Clough <jvc@ijmp.net> 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





      reply	other threads:[~2016-05-06 12:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-29  0:43 bug#21154: 24.5.50; LaTeX mode complains about mismatched parentheses on end commands Jeff Clough
2016-04-30 12:13 ` Marcin Borkowski
2016-05-02 10:32   ` Marcin Borkowski
2016-05-06 12:56     ` Marcin Borkowski [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zis3cpkd.fsf@mbork.pl \
    --to=mbork@mbork.pl \
    --cc=21154@debbugs.gnu.org \
    --cc=jvc@ijmp.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).