unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#9502: 23.3; [PATCH] hideshow no longer gets confused by characters in strings
@ 2011-09-14  7:38 Dima Kogan
  2011-09-22  7:24 ` Glenn Morris
  0 siblings, 1 reply; 2+ messages in thread
From: Dima Kogan @ 2011-09-14  7:38 UTC (permalink / raw)
  To: 9502

[-- Attachment #1: Type: text/plain, Size: 206 bytes --]

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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 1959 bytes --]

From d85459ad47b23dfc8fe2689cd3cc059e9c956544 Mon Sep 17 00:00:00 2001
From: Dima Kogan <dima@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@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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* bug#9502: 23.3; [PATCH] hideshow no longer gets confused by characters in strings
  2011-09-14  7:38 bug#9502: 23.3; [PATCH] hideshow no longer gets confused by characters in strings Dima Kogan
@ 2011-09-22  7:24 ` Glenn Morris
  0 siblings, 0 replies; 2+ messages in thread
From: Glenn Morris @ 2011-09-22  7:24 UTC (permalink / raw)
  To: 9502-done

Version: 24.1

Thanks; applied.





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-09-22  7:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-14  7:38 bug#9502: 23.3; [PATCH] hideshow no longer gets confused by characters in strings Dima Kogan
2011-09-22  7:24 ` Glenn Morris

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).