diff options
| author | Dima Kogan | 2011-09-22 00:24:08 -0700 |
|---|---|---|
| committer | Glenn Morris | 2011-09-22 00:24:08 -0700 |
| commit | bfeef8b6da2d8fad8cf2562bed35dbbc576a9d0c (patch) | |
| tree | c2665625cd7c2334363340013219c3e3c9a1e29c | |
| parent | 7e423bb823bf68b809364650b364f21f6fd835a0 (diff) | |
| download | emacs-bfeef8b6da2d8fad8cf2562bed35dbbc576a9d0c.tar.gz emacs-bfeef8b6da2d8fad8cf2562bed35dbbc576a9d0c.zip | |
Small hideshow fix - ignore strings as well as comments (tiny change)
* lisp/progmodes/hideshow.el (hs-looking-at-block-start-p)
(hs-find-block-beginning, hs-hide-level-recursive):
Ignore strings as well as comments.
Fixes: debbugs:9502
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/progmodes/hideshow.el | 8 |
2 files changed, 10 insertions, 4 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 4a60247a4c7..f1cdee00c97 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2011-09-22 Dima Kogan <dkogan@secretsauce.net> (tiny change) | ||
| 2 | |||
| 3 | * progmodes/hideshow.el (hs-looking-at-block-start-p) | ||
| 4 | (hs-find-block-beginning, hs-hide-level-recursive): | ||
| 5 | Ignore strings as well as comments. (Bug#9502) | ||
| 6 | |||
| 1 | 2011-09-22 Andrew Schein <andrew@andrewschein.com> (tiny change) | 7 | 2011-09-22 Andrew Schein <andrew@andrewschein.com> (tiny change) |
| 2 | 8 | ||
| 3 | * progmodes/sql.el (sql-comint-postgres): | 9 | * progmodes/sql.el (sql-comint-postgres): |
diff --git a/lisp/progmodes/hideshow.el b/lisp/progmodes/hideshow.el index 49202ab6692..ca8be01d4a8 100644 --- a/lisp/progmodes/hideshow.el +++ b/lisp/progmodes/hideshow.el | |||
| @@ -539,7 +539,7 @@ property of an overlay." | |||
| 539 | (defun hs-looking-at-block-start-p () | 539 | (defun hs-looking-at-block-start-p () |
| 540 | "Return non-nil if the point is at the block start." | 540 | "Return non-nil if the point is at the block start." |
| 541 | (and (looking-at hs-block-start-regexp) | 541 | (and (looking-at hs-block-start-regexp) |
| 542 | (save-match-data (not (nth 4 (syntax-ppss)))))) | 542 | (save-match-data (not (nth 8 (syntax-ppss)))))) |
| 543 | 543 | ||
| 544 | (defun hs-forward-sexp (match-data arg) | 544 | (defun hs-forward-sexp (match-data arg) |
| 545 | "Adjust point based on MATCH-DATA and call `hs-forward-sexp-func' w/ ARG. | 545 | "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." | |||
| 693 | (point) | 693 | (point) |
| 694 | ;; look backward for the start of a block that contains the cursor | 694 | ;; look backward for the start of a block that contains the cursor |
| 695 | (while (and (re-search-backward hs-block-start-regexp nil t) | 695 | (while (and (re-search-backward hs-block-start-regexp nil t) |
| 696 | ;; go again if in a comment | 696 | ;; go again if in a comment or a string |
| 697 | (or (save-match-data (nth 4 (syntax-ppss))) | 697 | (or (save-match-data (nth 8 (syntax-ppss))) |
| 698 | (not (setq done | 698 | (not (setq done |
| 699 | (< here (save-excursion | 699 | (< here (save-excursion |
| 700 | (hs-forward-sexp (match-data t) 1) | 700 | (hs-forward-sexp (match-data t) 1) |
| @@ -718,7 +718,7 @@ Return point, or nil if original point was not in a block." | |||
| 718 | (and (< (point) maxp) | 718 | (and (< (point) maxp) |
| 719 | (re-search-forward hs-block-start-regexp maxp t))) | 719 | (re-search-forward hs-block-start-regexp maxp t))) |
| 720 | (when (save-match-data | 720 | (when (save-match-data |
| 721 | (not (nth 4 (syntax-ppss)))) ; not inside comments | 721 | (not (nth 8 (syntax-ppss)))) ; not inside comments or strings |
| 722 | (if (> arg 1) | 722 | (if (> arg 1) |
| 723 | (hs-hide-level-recursive (1- arg) minp maxp) | 723 | (hs-hide-level-recursive (1- arg) minp maxp) |
| 724 | (goto-char (match-beginning hs-block-start-mdata-select)) | 724 | (goto-char (match-beginning hs-block-start-mdata-select)) |