From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Joe Wells Newsgroups: gmane.emacs.bugs Subject: Re: tex-validate-region reports false errors on some LaTeX commands Date: Sun, 09 Sep 2007 11:39:34 +0100 Message-ID: <867in0rul5.fsf@macs.hw.ac.uk> References: <861wd8trf5.fsf@macs.hw.ac.uk> <46E3B0B2.2070608@gmx.at> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: sea.gmane.org 1189336184 3287 80.91.229.12 (9 Sep 2007 11:09:44 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 9 Sep 2007 11:09:44 +0000 (UTC) Cc: bug-gnu-emacs@gnu.org To: martin rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Sep 09 21:09:31 2007 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1IURgv-0000OT-NJ for geb-bug-gnu-emacs@m.gmane.org; Sun, 09 Sep 2007 20:39:30 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IUKCZ-0004Em-Dy for geb-bug-gnu-emacs@m.gmane.org; Sun, 09 Sep 2007 06:39:39 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IUKCX-0004C9-6G for bug-gnu-emacs@gnu.org; Sun, 09 Sep 2007 06:39:37 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IUKCW-0004Al-NC for bug-gnu-emacs@gnu.org; Sun, 09 Sep 2007 06:39:36 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IUKCW-0004AV-Ck for bug-gnu-emacs@gnu.org; Sun, 09 Sep 2007 06:39:36 -0400 Original-Received: from izanami.macs.hw.ac.uk ([137.195.13.6]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1IUKCV-0003u3-Um for bug-gnu-emacs@gnu.org; Sun, 09 Sep 2007 06:39:36 -0400 Original-Received: from lxultra1.macs.hw.ac.uk ([137.195.27.173]:32815 helo=127.0.0.1) by izanami.macs.hw.ac.uk with smtp (Exim 4.51) id 1IUKCU-000278-KU; Sun, 09 Sep 2007 11:39:34 +0100 Original-Received: (nullmailer pid 31395 invoked by uid 1001); Sun, 09 Sep 2007 10:39:34 -0000 In-Reply-To: <46E3B0B2.2070608@gmx.at> (martin rudalics's message of "Sun\, 09 Sep 2007 10\:37\:06 +0200") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) X-Detected-Kernel: Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:16516 Archived-At: martin rudalics writes: >> The easy fix is to simply ignore open parentheses (also open square >> brackets) that are preceded by a backslash. If things are fixed this >> way, then mismatched uses of \(, \), \[, and \] will not be diagnosed, >> but that is better than reporting zillions of false errors. > > We could give the backslash before paren style characters some > syntax-table property (punctuation?). We'd match "\(" with ")" then. > Would that harm much? The correct solution would require that \(, \), \[, and \] are treated the same as \begin{math}, \end{math}, \begin{displaymath}, and \end{displaymath}. (The latter are defined in terms of the former in latex.ltx.) Emacs already parses \begin{XYZ} and \end{XYZ} for use in forward-sexp. Anyway, the code in tex-validate-region seems to operate in two passes. The first pass verifies that the syntax parsing underlying forward-sexp is happy. The second pass seems to be oriented at making ordinary parentheses/brackets/braces match. I'm not entirely sure why two passes should be needed. Can anyone explain? Note that strange things happen with syntax parsing in LaTeX. Consider this text: (\begin{quote}) \end{quote} If you put point to the left of the =E2=80=9C(=E2=80=9D, then forward-sexp = moves to the right of the =E2=80=9C)=E2=80=9D. If you put point before the \begin{q= uote}, then forward-sexp moves to the right of the \end{quote}. This all happens despite the fact that the structures are not balanced properly. Can anyone explain this bizarreness? --=20 Joe