GNU bug report logs - #9502
23.3; [PATCH] hideshow no longer gets confused by characters in strings

Previous Next

Package: emacs;

Reported by: Dima Kogan <dkogan <at> secretsauce.net>

Date: Wed, 14 Sep 2011 08:24:02 UTC

Severity: normal

Tags: patch

Found in version 23.3

Fixed in version 24.1

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 9502 in the body.
You can then email your comments to 9502 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9502; Package emacs. (Wed, 14 Sep 2011 08:24:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Dima Kogan <dkogan <at> secretsauce.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 14 Sep 2011 08:24:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Dima Kogan <dkogan <at> secretsauce.net>
To: bug-gnu-emacs <at> gnu.org
Subject: 23.3;
	[PATCH] hideshow no longer gets confused by characters in strings
Date: Wed, 14 Sep 2011 00:38:31 -0700
[Message part 1 (text/plain, inline)]
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.

[0001-hideshow-now-doesn-t-get-confused-by-characters-in-c.patch (text/x-diff, inline)]
From d85459ad47b23dfc8fe2689cd3cc059e9c956544 Mon Sep 17 00:00:00 2001
From: Dima Kogan <dima <at> secretsauce.net>
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 <dima <at> secretsauce.net>
---
 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


Reply sent to Glenn Morris <rgm <at> gnu.org>:
You have taken responsibility. (Thu, 22 Sep 2011 07:25:01 GMT) Full text and rfc822 format available.

Notification sent to Dima Kogan <dkogan <at> secretsauce.net>:
bug acknowledged by developer. (Thu, 22 Sep 2011 07:25:02 GMT) Full text and rfc822 format available.

Message #10 received at 9502-done <at> debbugs.gnu.org (full text, mbox):

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

Thanks; applied.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 20 Oct 2011 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 13 years and 298 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.