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: Acknowledgement ([PATCH] Prevent hide-show mode from getting confused by braces in comments) Date: Mon, 14 Feb 2011 20:20:38 -0800 Message-ID: <20110214202038.4dc03ccc@smart> References: <20110213230257.784a9843@smart> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="MP_/wao/WWZRLIu=tMb33Zg7r1y" X-Trace: dough.gmane.org 1297744599 10496 80.91.229.12 (15 Feb 2011 04:36:39 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 15 Feb 2011 04:36:39 +0000 (UTC) To: 8036@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Feb 15 05:36:35 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 1PpCeR-0003Cy-Hq for geb-bug-gnu-emacs@m.gmane.org; Tue, 15 Feb 2011 05:36:35 +0100 Original-Received: from localhost ([127.0.0.1]:53561 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PpCeR-0001MN-4Q for geb-bug-gnu-emacs@m.gmane.org; Mon, 14 Feb 2011 23:36:35 -0500 Original-Received: from [140.186.70.92] (port=40524 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PpCeL-0001MH-OC for bug-gnu-emacs@gnu.org; Mon, 14 Feb 2011 23:36:31 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PpCeK-0007Di-J0 for bug-gnu-emacs@gnu.org; Mon, 14 Feb 2011 23:36:29 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:36323) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PpCeK-0007De-8i for bug-gnu-emacs@gnu.org; Mon, 14 Feb 2011 23:36:28 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1PpCGg-0006RX-KO; Mon, 14 Feb 2011 23:12: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: Tue, 15 Feb 2011 04:12: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.129774310724743 (code B ref 8036); Tue, 15 Feb 2011 04:12:02 +0000 Original-Received: (at 8036) by debbugs.gnu.org; 15 Feb 2011 04:11:47 +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 1PpCGR-0006R2-7A for submit@debbugs.gnu.org; Mon, 14 Feb 2011 23:11:47 -0500 Original-Received: from ibar.cds.caltech.edu ([131.215.42.49]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PpCGN-0006Qo-SG for 8036@debbugs.gnu.org; Mon, 14 Feb 2011 23:11:45 -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 DCECEBA8276 for <8036@debbugs.gnu.org>; Mon, 14 Feb 2011 20:20:39 -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: Mon, 14 Feb 2011 23:12: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:44140 Archived-At: --MP_/wao/WWZRLIu=tMb33Zg7r1y Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline I accidentally attached the Dmitry's original patch file, that contains both the merged and unmerged fixes. Further, it appears that Dmitry's original patch handles the case where hs-hide-all is called in the attached sample perl script, BUT it does not handle the case where hs-hide-level is called with the point at the end of the buffer. I'm attaching a new patch that ONLY contains the pertinent changes and that addresses the second issue also. --MP_/wao/WWZRLIu=tMb33Zg7r1y 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-14 20:11:17.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 (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_/wao/WWZRLIu=tMb33Zg7r1y--