GNU bug report logs - #21154
24.5.50; LaTeX mode complains about mismatched parentheses on end commands

Previous Next

Package: emacs;

Reported by: Jeff Clough <jvc <at> ijmp.net>

Date: Wed, 29 Jul 2015 06:08:01 UTC

Severity: normal

Found in version 24.5.50

To reply to this bug, email your comments to 21154 AT debbugs.gnu.org.

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#21154; Package emacs. (Wed, 29 Jul 2015 06:08:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Jeff Clough <jvc <at> ijmp.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 29 Jul 2015 06:08:02 GMT) Full text and rfc822 format available.

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

From: Jeff Clough <jvc <at> ijmp.net>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.5.50;
 LaTeX mode complains about mismatched parentheses on end commands
Date: Tue, 28 Jul 2015 20:43:55 -0400
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.



In GNU Emacs 24.5.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.10.8)
 of 2015-07-02 on jeff-Inspiron-3537
Repository revision: a5e6f33b4c8222ad62fdd7ff4bb0f8c5fac432c1
Windowing system distributor `The X.Org Foundation', version 11.0.11600000
System Description:	Ubuntu 14.04.2 LTS

Important settings:
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Shell

Minor modes in effect:
  shell-dirtrack-mode: t
  tooltip-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  global-visual-line-mode: t
  visual-line-mode: t
  transient-mark-mode: t

Recent messages:
Reading active file via nndraft...done
Checking new news...done
No news is good news
Are you sure you want to quit reading news? (y or n) y
Saving file /home/jeff/.newsrc...
Wrote /home/jeff/.newsrc
Saving /home/jeff/.newsrc.eld...
Saving file /home/jeff/.newsrc.eld...
Wrote /home/jeff/.newsrc.eld
Saving /home/jeff/.newsrc.eld...done

Load-path shadows:
None found.

Features:
(shadow emacsbug mule-util smiley gnus-cite gnus-async gnus-bcklg
gnus-draft gnus-ml pcmpl-unix mailalias mail-extr sort nndraft nnmh
nnfolder utf-7 gnutls network-stream starttls nnimap parse-time tls utf7
netrc gnus-agent gnus-srvr gnus-score score-mode nnvirtual gnus-msg
gnus-art mm-uu mml2015 epg-config mm-view mml-smime smime dig mailcap
nntp gnus-cache gnus-sum nnoo gnus-group gnus-undo nnmail mail-source
smtpmail auth-source eieio byte-opt bytecomp byte-compile cl-extra cconv
eieio-core password-cache sendmail gnus-start gnus-spec gnus-int
gnus-range message rfc822 mml mml-sec mm-decode mm-bodies mm-encode
mail-parse rfc2231 rfc2047 rfc2045 ietf-drums mailabbrev gmm-utils
mailheader gnus-win gnus gnus-ems nnheader gnus-util mail-utils mm-util
mail-prsvr wid-edit manoj-dark-theme ob-sh shell ob-python server
web-mode advice help-fns derived disp-table ox-odt rng-loc rng-uri
rng-parse rng-match rng-dt rng-util rng-pttrn nxml-parse nxml-ns
nxml-enc xmltok nxml-util ox-latex ox-icalendar ox-html ox-ascii
ox-publish ox org-element edmacro kmacro cl-loaddefs cl-lib org
org-macro org-footnote org-pcomplete pcomplete org-list org-faces
org-entities noutline outline easy-mmode org-version ob-emacs-lisp ob
ob-tangle ob-ref ob-lob ob-table ob-exp org-src ob-keys ob-comint comint
ansi-color ring ob-core ob-eval org-compat org-macs org-loaddefs
format-spec find-func cal-menu easymenu calendar cal-loaddefs time-date
tooltip electric uniquify ediff-hook vc-hooks lisp-float-type mwheel
x-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list
newcomment lisp-mode prog-mode register page menu-bar rfn-eshadow timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai
tai-viet lao korean japanese hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help
simple abbrev minibuffer nadvice loaddefs button faces cus-face macroexp
files text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote make-network-process
dbusbind gfilenotify dynamic-setting system-font-setting
font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs)

Memory information:
((conses 16 281425 21885)
 (symbols 48 36524 20)
 (miscs 40 131 300)
 (strings 32 67759 8501)
 (string-bytes 1 2153683)
 (vectors 16 28380)
 (vector-slots 8 597568 11077)
 (floats 8 286 597)
 (intervals 56 572 110)
 (buffers 960 21)
 (heap 1024 29658 8203))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21154; Package emacs. (Sat, 30 Apr 2016 12:15:02 GMT) Full text and rfc822 format available.

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

From: Marcin Borkowski <mbork <at> mbork.pl>
To: Jeff Clough <jvc <at> ijmp.net>
Cc: 21154 <at> debbugs.gnu.org
Subject: Re: bug#21154: 24.5.50;
 LaTeX mode complains about mismatched parentheses on end commands
Date: Sat, 30 Apr 2016 14:13:48 +0200
On 2015-07-28, at 20:43, Jeff Clough <jvc <at> 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.

Best,

-- 
Marcin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21154; Package emacs. (Mon, 02 May 2016 10:33:01 GMT) Full text and rfc822 format available.

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

From: Marcin Borkowski <mbork <at> mbork.pl>
To: Jeff Clough <jvc <at> ijmp.net>
Cc: 21154 <at> debbugs.gnu.org
Subject: Re: bug#21154: 24.5.50;
 LaTeX mode complains about mismatched parentheses on end commands
Date: Mon, 02 May 2016 12:32:19 +0200
On 2016-04-30, at 14:13, Marcin Borkowski <mbork <at> mbork.pl> wrote:

> On 2015-07-28, at 20:43, Jeff Clough <jvc <at> 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.

Best,

-- 
Marcin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21154; Package emacs. (Fri, 06 May 2016 12:58:02 GMT) Full text and rfc822 format available.

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

From: Marcin Borkowski <mbork <at> mbork.pl>
To: Jeff Clough <jvc <at> ijmp.net>
Cc: 21154 <at> debbugs.gnu.org
Subject: Re: bug#21154: 24.5.50;
 LaTeX mode complains about mismatched parentheses on end commands
Date: Fri, 06 May 2016 14:56:50 +0200
On 2016-05-02, at 12:32, Marcin Borkowski <mbork <at> mbork.pl> wrote:

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




This bug report was last modified 9 years and 124 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.