From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dima Kogan Newsgroups: gmane.emacs.bugs Subject: bug#8036: [PATCH] Prevent hide-show mode from getting confused by braces in comments Date: Tue, 15 Feb 2011 21:01:59 -0800 Message-ID: <20110215210159.4ea00047@smart> References: <20110213230257.784a9843@smart> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="MP_/0L_ZWdUQ=D0WBot6KcStFul" X-Trace: dough.gmane.org 1297832817 6596 80.91.229.12 (16 Feb 2011 05:06:57 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 16 Feb 2011 05:06:57 +0000 (UTC) To: 8036@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Feb 16 06:06:45 2011 Return-path: Envelope-to: geb-bug-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 1PpZb8-0001Y0-EI for geb-bug-gnu-emacs@m.gmane.org; Wed, 16 Feb 2011 06:06:42 +0100 Original-Received: from localhost ([127.0.0.1]:54589 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PpZb6-0000q0-Nd for geb-bug-gnu-emacs@m.gmane.org; Wed, 16 Feb 2011 00:06:40 -0500 Original-Received: from [140.186.70.92] (port=34669 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PpZaz-0000po-1I for bug-gnu-emacs@gnu.org; Wed, 16 Feb 2011 00:06:35 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PpZay-0005Na-8M for bug-gnu-emacs@gnu.org; Wed, 16 Feb 2011 00:06:33 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:48116) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PpZay-0005NV-5U for bug-gnu-emacs@gnu.org; Wed, 16 Feb 2011 00:06:32 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1PpZOs-0007mw-8E; Tue, 15 Feb 2011 23:54:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Dima Kogan Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 16 Feb 2011 04:54:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 8036 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 8036-submit@debbugs.gnu.org id=B8036.129783198329874 (code B ref 8036); Wed, 16 Feb 2011 04:54:02 +0000 Original-Received: (at 8036) by debbugs.gnu.org; 16 Feb 2011 04:53:03 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PpZNv-0007ln-3H for submit@debbugs.gnu.org; Tue, 15 Feb 2011 23:53:03 -0500 Original-Received: from ibar.cds.caltech.edu ([131.215.42.49]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PpZNt-0007lK-HK for 8036@debbugs.gnu.org; Tue, 15 Feb 2011 23:53:02 -0500 Original-Received: from smart (cpe-76-175-234-46.socal.res.rr.com [76.175.234.46]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by ibar.cds.caltech.edu (Postfix) with ESMTP id 06AE0BA81F7 for <8036@debbugs.gnu.org>; Tue, 15 Feb 2011 21:02:00 -0800 (PST) In-Reply-To: X-Mailer: Claws Mail 3.7.6 (GTK+ 2.20.1; x86_64-pc-linux-gnu) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Tue, 15 Feb 2011 23:54:02 -0500 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:44166 Archived-At: --MP_/0L_ZWdUQ=D0WBot6KcStFul Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline I have discovered a case where the previous patch causes an infinite loop. The new patch I'm attaching resolves that issue --MP_/0L_ZWdUQ=D0WBot6KcStFul Content-Type: text/x-patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=hideshow-comments.patch --- hideshow.orig.el 2011-02-13 23:01:07.000000000 -0800 +++ hideshow.el 2011-02-15 20:58:14.000000000 -0800 @@ -690,6 +690,7 @@ (point) ;; look backward for the start of a block that contains the cursor (while (and (re-search-backward hs-block-start-regexp nil t) + (save-match-data (not (nth 4 (syntax-ppss)))) ; not inside comments (not (setq done (< here (save-excursion (hs-forward-sexp (match-data t) 1) @@ -712,10 +713,11 @@ (forward-comment (buffer-size)) (and (< (point) maxp) (re-search-forward hs-block-start-regexp maxp t))) - (if (> arg 1) - (hs-hide-level-recursive (1- arg) minp maxp) - (goto-char (match-beginning hs-block-start-mdata-select)) - (hs-hide-block-at-point t))) + (when (save-match-data (not (nth 4 (syntax-ppss)))) ; not inside comments + (if (> arg 1) + (hs-hide-level-recursive (1- arg) minp maxp) + (goto-char (match-beginning hs-block-start-mdata-select)) + (hs-hide-block-at-point t)))) (goto-char maxp)) (defmacro hs-life-goes-on (&rest body) --MP_/0L_ZWdUQ=D0WBot6KcStFul--