Subject: bug#49080: 28.0.50; latex-forward-sexp scan error (unbalanced parens) when parens are balanced

From: Lars Ingebrigtsen <[email-masked]>
Date: Sat, 19 Jun 2021 15:32:32 +0200

Ahmed Khaled <[email-masked]> writes:

> In tex-mode, latex-forward-sexp does not correctly handle parentheses
> like this \[ \]. In particular, it says the expression is not balanced
> when it is.
>
> Steps to reproduce the bug:
> 1. Start with emacs -Q (with -nw or without doesn't make a difference)
> 2. Open any .tex file (I attached test.tex which I used).
> 3. Navigate to any LaTeX equation delimited by \[ and \], like this:
> \[ 1 + 1 = 2 \]
> 4. Put the cursor on the first [ in the line:
> 5. Call latex-forward-sexp
>
> That's it. On test.tex, the error I get is:
>        Scan error: "Unbalanced parentheses", 126, 157
> Note that if the cursor is on the backslash, rather than [, then there
> is no error.

I think that's correct behaviour?  The parentheses start is \[ and not
just [.

Anybody have any opinion here?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no