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#9502: 23.3; [PATCH] hideshow no longer gets confused by characters in strings Date: Wed, 14 Sep 2011 00:38:31 -0700 Message-ID: <87zki760aw.fsf@secretsauce.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: dough.gmane.org 1315988448 11746 80.91.229.12 (14 Sep 2011 08:20:48 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 14 Sep 2011 08:20:48 +0000 (UTC) To: 9502@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Sep 14 10:20:44 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1R3ki3-00053Z-SC for geb-bug-gnu-emacs@m.gmane.org; Wed, 14 Sep 2011 10:20:44 +0200 Original-Received: from localhost ([::1]:59274 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R3ki3-0005JI-9w for geb-bug-gnu-emacs@m.gmane.org; Wed, 14 Sep 2011 04:20:43 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:42020) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R3kha-0005DU-Dz for bug-gnu-emacs@gnu.org; Wed, 14 Sep 2011 04:20:15 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R3kgt-0001MG-19 for bug-gnu-emacs@gnu.org; Wed, 14 Sep 2011 04:20:14 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:58326) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R3kgs-0001M8-UQ for bug-gnu-emacs@gnu.org; Wed, 14 Sep 2011 04:19:30 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1R3klG-0007YA-9W; Wed, 14 Sep 2011 04:24:02 -0400 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, 14 Sep 2011 08:24:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 9502 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.131598861528976 (code B ref -1); Wed, 14 Sep 2011 08:24:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 14 Sep 2011 08:23:35 +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 1R3kko-0007XH-1C for submit@debbugs.gnu.org; Wed, 14 Sep 2011 04:23:35 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R3k75-0004EB-5H for submit@debbugs.gnu.org; Wed, 14 Sep 2011 03:42:32 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R3k2c-0000B0-98 for submit@debbugs.gnu.org; Wed, 14 Sep 2011 03:37:59 -0400 Original-Received: from lists.gnu.org ([140.186.70.17]:49501) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R3k2c-0000Aw-5p for submit@debbugs.gnu.org; Wed, 14 Sep 2011 03:37:54 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:43113) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R3k2Y-00032F-3R for bug-gnu-emacs@gnu.org; Wed, 14 Sep 2011 03:37:54 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R3k2S-00009m-Di for bug-gnu-emacs@gnu.org; Wed, 14 Sep 2011 03:37:50 -0400 Original-Received: from hrndva-omtalb.mail.rr.com ([71.74.56.124]:63408) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R3k2S-00009G-7R for bug-gnu-emacs@gnu.org; Wed, 14 Sep 2011 03:37:44 -0400 X-Authority-Analysis: v=1.1 cv=8/tC3RumM5rsUT5KRAstW8ZpQtAyVpHweSUJct9LT6E= c=1 sm=0 a=d-0ZG_wKo_UA:10 a=v7wRtcRC0aAA:10 a=syinx_Tw3_MA:10 a=8YMtuzaJ5FE3wtSInqJrPg==:17 a=cz3Tp05_fwVXJbveM74A:9 a=ncDVm-j7AAAA:8 a=SymZfQVOR78kzRsFMcMA:9 a=iFMZv00P5aE_SaS3JS4A:7 a=1TAlIYiSTWAA:10 a=8YMtuzaJ5FE3wtSInqJrPg==:117 X-Cloudmark-Score: 0 X-Originating-IP: 76.175.234.46 Original-Received: from [76.175.234.46] ([76.175.234.46:52716] helo=smart) by hrndva-oedge02.mail.rr.com (envelope-from ) (ecelerity 2.2.3.46 r()) with ESMTP id 82/AD-05516-5C9507E4; Wed, 14 Sep 2011 07:37:41 +0000 Original-Received: from dkogan by smart with local (Exim 4.76) (envelope-from ) id 1R3k3D-0007zh-C5 for bug-gnu-emacs@gnu.org; Wed, 14 Sep 2011 00:38:31 -0700 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Mailman-Approved-At: Wed, 14 Sep 2011 04:23:31 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Wed, 14 Sep 2011 04:24:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 1) X-Received-From: 140.186.70.43 X-Mailman-Approved-At: Wed, 14 Sep 2011 04:20:40 -0400 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: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:51134 Archived-At: --=-=-= An earlier patch (bug 8279) made hideshow robust to various characters appearing in comments. Here's a small patch that extends this, so that hideshow becomes robust to various characters in strings also. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-hideshow-now-doesn-t-get-confused-by-characters-in-c.patch Content-Description: patch >From d85459ad47b23dfc8fe2689cd3cc059e9c956544 Mon Sep 17 00:00:00 2001 From: Dima Kogan Date: Wed, 14 Sep 2011 00:29:01 -0700 Subject: [PATCH] hideshow now doesn't get confused by characters in comments OR strings Signed-off-by: Dima Kogan --- lisp/progmodes/hideshow.el | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lisp/progmodes/hideshow.el b/lisp/progmodes/hideshow.el index 49202ab..ca8be01 100644 --- a/lisp/progmodes/hideshow.el +++ b/lisp/progmodes/hideshow.el @@ -539,7 +539,7 @@ property of an overlay." (defun hs-looking-at-block-start-p () "Return non-nil if the point is at the block start." (and (looking-at hs-block-start-regexp) - (save-match-data (not (nth 4 (syntax-ppss)))))) + (save-match-data (not (nth 8 (syntax-ppss)))))) (defun hs-forward-sexp (match-data arg) "Adjust point based on MATCH-DATA and call `hs-forward-sexp-func' w/ ARG. @@ -693,8 +693,8 @@ Return point, or nil if original point was not in a block." (point) ;; look backward for the start of a block that contains the cursor (while (and (re-search-backward hs-block-start-regexp nil t) - ;; go again if in a comment - (or (save-match-data (nth 4 (syntax-ppss))) + ;; go again if in a comment or a string + (or (save-match-data (nth 8 (syntax-ppss))) (not (setq done (< here (save-excursion (hs-forward-sexp (match-data t) 1) @@ -718,7 +718,7 @@ Return point, or nil if original point was not in a block." (and (< (point) maxp) (re-search-forward hs-block-start-regexp maxp t))) (when (save-match-data - (not (nth 4 (syntax-ppss)))) ; not inside comments + (not (nth 8 (syntax-ppss)))) ; not inside comments or strings (if (> arg 1) (hs-hide-level-recursive (1- arg) minp maxp) (goto-char (match-beginning hs-block-start-mdata-select)) -- 1.7.5.4 --=-=-=--