Subject: bug#9502: closed (Re: bug#9502: 23.3; [PATCH] hideshow no longer gets confused by characters in strings)

From: [email-masked] (GNU bug Tracking System)
Date: Thu, 22 Sep 2011 07:25:02 +0000

Your bug report

#9502: 23.3; [PATCH] hideshow no longer gets confused by characters in strings

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
9502: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9502
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#9502: 23.3; [PATCH] hideshow no longer gets confused by characters in strings
From: Glenn Morris <[email-masked]>
To: [email-masked]
Date: Thu, 22 Sep 2011 03:24:30 -0400
List-Id: <debbugs-submit.debbugs.gnu.org>

Version: 24.1

Thanks; applied.

Subject: 23.3; [PATCH] hideshow no longer gets confused by characters in strings
From: Dima Kogan <[email-masked]>
To: [email-masked]
Date: Wed, 14 Sep 2011 00:38:31 -0700
List-Id: <debbugs-submit.debbugs.gnu.org>

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.

>From d85459ad47b23dfc8fe2689cd3cc059e9c956544 Mon Sep 17 00:00:00 2001
From: Dima Kogan <[email-masked]>
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 <[email-masked]>
---
 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