diff -Nu -L /usr/share/emacs/24.0.92/lisp/progmodes/hideshow.el.gz -L /tmp/buffer-content-28178nSw /tmp/jka-com281780c2 /tmp/buffer-content-28178nSw --- /usr/share/emacs/24.0.92/lisp/progmodes/hideshow.el.gz +++ /tmp/buffer-content-28178nSw @@ -804,9 +804,13 @@ ;; 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))