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: Pascal J. Bourguignon
Subject: Re: Comment lines and matching parentheses
Date: Tue, 04 May 2010 15:42:49 -0000
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.3 (darwin)

dnquark <dnquark@gmail.com> writes:

> 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.
>
> Is there a way to make emacs ignore all parentheses that are parts of
> comments?..  This behavior sometimes breaks hs-minor-mode's ability to
> fold code in buffers.

In lisp-mode (or emacs-lisp-mode), parentheses in comments are not
identified as parentheses to be matched.  The following check-parens
correctly:

(
 ;; (
 ;; ))
 )

And similarly in c-mode (and derived such as c++-mode):

{
    (
     // (
     // ))
     )
    }

check-parens correctly too.


So I don't observe what you're saying.  Here I use emacs-version
"22.3.1", but I never noticed the bad behavior your describe in any
emacs version from 18 to 23, as long as the correct mode is applied to
the buffer.

Now, I don't use hs-minor-mode.  Perhaps this is the problem.  Perhaps
check-parens and other parenthesis balancing code cannot deal with
parentheses that are hidden by hs-minor-mode?


-- 
__Pascal Bourguignon__


reply via email to

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