[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Comment lines and matching parentheses
From: |
dnquark |
Subject: |
Re: Comment lines and matching parentheses |
Date: |
Tue, 04 May 2010 15:42:50 -0000 |
User-agent: |
G2/1.0 |
> > 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.
>
> No, there isn't. A paren in a comment will only balance a matching one
> in the same comment. If you're able and willing to change the source
> code, you could rewrite the first example as:
> /* (
> ) */
> .
>
> But it sounds more like there's a bug in hs-minor-mode, which you might
> "want" to report.
Thanks everyone for the replies. I was basing my definition of
"mismatched parentheses" on whether or not the closing paren resulted
in "mismatched parentheses" message in the echo area. Despite this
message, check-parens ignores comments, as it should.
The problem indeed appears to be a bug in hs-minor-mode. It doesn't
handle well the case where commented parens appear on a line that
starts with regular code, e.g.
foo ## (
## )
In this case, hs-hide-all results in "scan error: unbalanced
parentheses". If the lines start with comments, it runs fine (I
believe hs-hide-all handles such lines differently in the first
place). Looking at the code for hideshow.el, it looks like it simply
searches for open parens using re-search-forward, and doesn't ignore
comments...
- Comment lines and matching parentheses, dnquark, 2010/05/04
- Re: Comment lines and matching parentheses, Alan Mackenzie, 2010/05/04
- Re: Comment lines and matching parentheses,
dnquark <=
- Re: Comment lines and matching parentheses, David Rogoff, 2010/05/04
- Re: Comment lines and matching parentheses, Pascal J. Bourguignon, 2010/05/04
- Re: Comment lines and matching parentheses, A.Politz, 2010/05/04
- Re: Comment lines and matching parentheses, Stefan Monnier, 2010/05/04