From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: dnquark Newsgroups: gmane.emacs.help Subject: Re: Comment lines and matching parentheses Date: Thu, 18 Mar 2010 19:26:41 -0700 (PDT) Organization: http://groups.google.com Message-ID: <423a35fd-5324-4ca6-ae7e-4d27605cc832@r27g2000yqn.googlegroups.com> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1272995790 29172 80.91.229.12 (4 May 2010 17:56:30 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 4 May 2010 17:56:30 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue May 04 19:56:29 2010 connect(): No such file or directory Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1O9MM2-0004h8-Or for geh-help-gnu-emacs@m.gmane.org; Tue, 04 May 2010 19:56:27 +0200 Original-Received: from localhost ([127.0.0.1]:39709 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O9MLt-00030P-15 for geh-help-gnu-emacs@m.gmane.org; Tue, 04 May 2010 13:56:13 -0400 Original-Path: usenet.stanford.edu!postnews.google.com!r27g2000yqn.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 31 Original-NNTP-Posting-Host: 98.222.198.121 Original-X-Trace: posting.google.com 1268965602 10662 127.0.0.1 (19 Mar 2010 02:26:42 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Fri, 19 Mar 2010 02:26:42 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: r27g2000yqn.googlegroups.com; posting-host=98.222.198.121; posting-account=nQKzDwoAAADiNnsVsJOw54VLeNKCeQkD User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100214 Ubuntu/9.10 (karmic) Firefox/3.5.8,gzip(gfe),gzip(gfe) Original-Xref: usenet.stanford.edu gnu.emacs.help:177507 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:73010 Archived-At: > > Is there a way to make emacs ignore all parentheses that are parts of > > comments?.. =A0This behavior sometimes breaks hs-minor-mode's ability t= o > > fold code in buffers. > > No, there isn't. =A0A paren in a comment will only balance a matching one > in the same comment. =A0If you're able and willing to change the source > code, you could rewrite the first example as: > =A0 /* ( > =A0 =A0 =A0) */ > . > > 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...