unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Joe Wells <jbw@macs.hw.ac.uk>
To: martin rudalics <rudalics@gmx.at>
Cc: bug-gnu-emacs@gnu.org
Subject: Re: tex-validate-region reports false errors on some LaTeX commands
Date: Sun, 09 Sep 2007 11:39:34 +0100	[thread overview]
Message-ID: <867in0rul5.fsf@macs.hw.ac.uk> (raw)
In-Reply-To: <46E3B0B2.2070608@gmx.at> (martin rudalics's message of "Sun\, 09 Sep 2007 10\:37\:06 +0200")

martin rudalics <rudalics@gmx.at> 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 “(”, then forward-sexp moves to
the right of the “)”.  If you put point before the \begin{quote}, 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?

-- 
Joe

  reply	other threads:[~2007-09-09 10:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <861wd8trf5.fsf@macs.hw.ac.uk>
2007-09-09  8:37 ` tex-validate-region reports false errors on some LaTeX commands martin rudalics
2007-09-09 10:39   ` Joe Wells [this message]
2007-09-21  3:09     ` Glenn Morris
2007-09-21 12:06       ` Joe Wells

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=867in0rul5.fsf@macs.hw.ac.uk \
    --to=jbw@macs.hw.ac.uk \
    --cc=bug-gnu-emacs@gnu.org \
    --cc=rudalics@gmx.at \
    /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).