* Re: tex-validate-region reports false errors on some LaTeX commands [not found] <861wd8trf5.fsf@macs.hw.ac.uk> @ 2007-09-09 8:37 ` martin rudalics 2007-09-09 10:39 ` Joe Wells 0 siblings, 1 reply; 4+ messages in thread From: martin rudalics @ 2007-09-09 8:37 UTC (permalink / raw) To: Joe Wells; +Cc: bug-gnu-emacs > 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? ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: tex-validate-region reports false errors on some LaTeX commands 2007-09-09 8:37 ` tex-validate-region reports false errors on some LaTeX commands martin rudalics @ 2007-09-09 10:39 ` Joe Wells 2007-09-21 3:09 ` Glenn Morris 0 siblings, 1 reply; 4+ messages in thread From: Joe Wells @ 2007-09-09 10:39 UTC (permalink / raw) To: martin rudalics; +Cc: bug-gnu-emacs 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 ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: tex-validate-region reports false errors on some LaTeX commands 2007-09-09 10:39 ` Joe Wells @ 2007-09-21 3:09 ` Glenn Morris 2007-09-21 12:06 ` Joe Wells 0 siblings, 1 reply; 4+ messages in thread From: Glenn Morris @ 2007-09-21 3:09 UTC (permalink / raw) To: Joe Wells; +Cc: bug-gnu-emacs Joe Wells wrote: > The correct solution would require that \(, \), \[, and \] are treated > the same as \begin{math}, \end{math}, \begin{displaymath}, and > \end{displaymath}. I've installed a hack fix along these lines in the trunk. I don't want to put it in the release branch, since I don't think the tex-validate-* functions are very important, and the sexp motion commands seem to be used quite a bit in tex-mode. > (\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. The latex-forward-sexp function is not rigorous. ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: tex-validate-region reports false errors on some LaTeX commands 2007-09-21 3:09 ` Glenn Morris @ 2007-09-21 12:06 ` Joe Wells 0 siblings, 0 replies; 4+ messages in thread From: Joe Wells @ 2007-09-21 12:06 UTC (permalink / raw) To: Glenn Morris; +Cc: bug-gnu-emacs Glenn Morris <rgm@gnu.org> writes: > Joe Wells wrote: > >> The correct solution would require that \(, \), \[, and \] are >> treated the same as \begin{math}, \end{math}, \begin{displaymath}, >> and \end{displaymath}. > > I've installed a hack fix along these lines in the trunk. I don't > want to put it in the release branch, since I don't think the > tex-validate-* functions are very important, and the sexp motion > commands seem to be used quite a bit in tex-mode. Okay. I don't understand the distinction between trunk and release branch here, but I assume this must be sensible. >> (\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. > > The latex-forward-sexp function is not rigorous. Indeed, it is a fairly gross kludge. It would be nice if font-locking could somehow set up syntax-table text properties to make this work correctly. However, I think the syntax-table text property feature is not sophisticated enough for handling LaTeX. You can only assign syntax-table text properties of the form (SYNTAX-CODE . MATCHING-CHAR). It is probably necessary for LaTeX to be able to do something of the form (SYNTAX-CODE . MATCHING-STRING). For example, “\begin{xyz}” would need a syntax-table text property that says it is matched by “\end{xyz}”. Right now you can only specify single matching characters. -- Joe ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-09-21 12:06 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [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 2007-09-21 3:09 ` Glenn Morris 2007-09-21 12:06 ` Joe Wells
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).