all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: dnquark <dnquark@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Comment lines and matching parentheses
Date: Thu, 18 Mar 2010 19:26:41 -0700 (PDT)	[thread overview]
Message-ID: <423a35fd-5324-4ca6-ae7e-4d27605cc832@r27g2000yqn.googlegroups.com> (raw)
In-Reply-To: hnu5sv$23o1$1@colin2.muc.de

> > 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...


  reply	other threads:[~2010-03-19  2:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-18 20:14 Comment lines and matching parentheses dnquark
2010-03-18 21:27 ` Alan Mackenzie
2010-03-19  2:26   ` dnquark [this message]
2010-03-18 21:29 ` David Rogoff
2010-03-18 22:43 ` Pascal J. Bourguignon
2010-03-18 23:48 ` A.Politz
2010-03-19  3:46 ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=423a35fd-5324-4ca6-ae7e-4d27605cc832@r27g2000yqn.googlegroups.com \
    --to=dnquark@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.