help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Comment lines and matching parentheses


From: Stefan Monnier
Subject: Re: Comment lines and matching parentheses
Date: Tue, 04 May 2010 15:42:51 -0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.93 (gnu/linux)

> What determines whether or not parentheses that are part of comments
> are included when performing paren matching?..  For instance, in C
> mode, both
>   // (
>   // )
> and
>   foo //(
>   bar //)
> are reported as mismatched parentheses. Similar behavior is observed
> in lisp mode.

The problem is that even though font-lock displays comments and strings
in a particular face, this information is not used by the code that
warns of "mismatched paren".  More specifically, this code always
assumes that point is outside of strings and comments, so any
string/comment boundary between the opening and the matching closing
paren will tend to throw it off.

Arguably, the code should check the "state at point" to see if we're in
a comment (or a string) and if so, only match against parentheses that are
themselves within comments (or strings), just like it correctly ignores
parens in strings and comments when point is not itself in a string or
a comment.  Patches welcome,


        Stefan


reply via email to

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