[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-AUCTeX] 11.83; Paren matching in AUCTeX

From: Shreevatsa R
Subject: Re: [Bug-AUCTeX] 11.83; Paren matching in AUCTeX
Date: Thu, 1 Mar 2007 20:00:40 +0530
User-agent: Mutt/1.5.13 (2006-08-11)

Quoting Ralf Angeli who at 2007-02-25 09:16:42+0100 (Sun) wrote
> * Shreevatsa R. (2007-02-25) writes:
> > I looked at that thread, and as I understand it, the issue is:
> >
> > * latex-mode defines \( and \) (and the others) as escaped, so
> > according to the syntax table of latex-mode, they are simply quoted
> > characters and don't correspond to each other.
> Yes.
> > * scan_lists (used by show-paren-mode, forward-sexp, etc.) regards
> > them as start/end of sexps despite the fact that they are escaped and
> > ought to have no syntactic meaning.
> >
> > So it is a bug, in some sense, with scan_lists, that it is trying to
> > match them, as you say.
> Yes.  But there is an additional bug in Show Paren mode because it
> doesn't check if a character with paren syntax is escaped when it
> starts the search for the matching one.
> > But from the LaTeX point of view, I think \( and \) and \[ and \],
> > aren't just escaped characters (maybe \{ and \} are). They have a role
> > in the syntax and if they don't match, LaTeX will complain... so it
> > useful and desirable to have sexp- and paren matching work on them. Is
> > it possible to redefine them appropriately, or does "\" have to escape
> > its next character universally or not at all?
> A character has a certain syntax set in the syntax table throughout
> the whole region where the syntax table is active.  I don't know of
> any mechanism to override that syntax according to the context of the
> character.  And I doubt it would be the right thing to do.
> What might be a possibility would be to extend Show Paren mode in way
> that it can work with regexps as well (similar to how font locking
> works).  That could be worth a feature request on emacs-devel.  I'm
> not sure if something like that would be feasible and sensible for
> `scan_lists' or `forward-sexp' for that matter as well.
> > This will not entirely solve the problem -- the bug with scan_lists
> > will still cause show-paren-mode to crib on \{ and \} -- but I think
> > it would be the right thing to do, if possible.
> Personally I'd value a fix for the currently observable mismatch
> problem higher.


(Sorry for the delay in replying.)

So I understand that, w.r.t the currently observable mismatch,
 * there are bugs in scan_lists *and* show-paren-mode -- they try to
   match characters with escaped syntax.
 * This has already been reported years ago, and needs to be fixed in
   Emacs proper.
 * It is not possible to make \[ \] \( and \) *not* have escaped
   syntax without entirely getting rid of \ as an escaped character.
 * You believe that the ideal situation would be if show-paren-mode
   stopped trying to match the escaped parens.

I believe that the ideal situation would be if \[ \] \( \) *were*
matched, given the syntax of LaTeX. This seems to require extending
show-paren-mode, to fit with the current situation.

But considering that they *are* matched in some other modes
(text-mode, say), and that the current mismatch is quite annoying, the
temporary solution I would like until a comprehensive fix comes along
would be to disable the escaping nature of \ altogether (this would
start matching \{ and \}, but they almost always go together in
"normal" usage so it is not a problem IMO).

Of course, there may be reasons why it is necessary/useful to keep the
\ as escaping, so it may not be the right thing for AUCTeX to do; it's
something I need to figure out for myself as a "user" kludge... er,
help? :-)

Shreevatsa R

reply via email to

[Prev in Thread] Current Thread [Next in Thread]