diff options
author | Sébastien Gross <seb@chezwam.org> | 2012-04-11 01:34:25 +0200 |
---|---|---|
committer | Lars Magne Ingebrigtsen <larsi@gnus.org> | 2012-04-11 01:34:25 +0200 |
commit | 43956923c00921499e0582f5da4cd739bc005240 (patch) | |
tree | b48e3a37eeac2cb1ab6a62bdc3d6189b1238ee78 /lisp/progmodes/hideshow.el | |
parent | 6a8c9eafb92f15fd9194cb38499008f1f4579e20 (diff) | |
download | emacs-43956923c00921499e0582f5da4cd739bc005240.tar.gz |
(hs-hide-all): Don't infloop on comments that start in the middle of the line.
Fixes: debbugs:10496
Diffstat (limited to 'lisp/progmodes/hideshow.el')
-rw-r--r-- | lisp/progmodes/hideshow.el | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lisp/progmodes/hideshow.el b/lisp/progmodes/hideshow.el index e2016e206a8..b6d2b5e319c 100644 --- a/lisp/progmodes/hideshow.el +++ b/lisp/progmodes/hideshow.el @@ -802,12 +802,15 @@ If `hs-hide-comments-when-hiding-all' is non-nil, also hide the comments." (forward-comment (point-max))) (re-search-forward re (point-max) t)) (if (match-beginning 1) - ;; we have found a block beginning + ;; We have found a block beginning. (progn (goto-char (match-beginning 1)) - (if hs-hide-all-non-comment-function - (funcall hs-hide-all-non-comment-function) - (hs-hide-block-at-point t))) + (unless (if hs-hide-all-non-comment-function + (funcall hs-hide-all-non-comment-function) + (hs-hide-block-at-point t)) + ;; Go to end of matched data to prevent from getting stuck + ;; with an endless loop. + (goto-char (match-end 0)))) ;; found a comment, probably (let ((c-reg (hs-inside-comment-p))) (when (and c-reg (car c-reg)) |