]> git.eshelyaron.com Git - emacs.git/commitdiff
(hs-hide-all): Don't infloop on comments that start in the middle of the line.
authorSébastien Gross <seb@chezwam.org>
Tue, 10 Apr 2012 23:34:25 +0000 (01:34 +0200)
committerLars Magne Ingebrigtsen <larsi@gnus.org>
Tue, 10 Apr 2012 23:34:25 +0000 (01:34 +0200)
Fixes: debbugs:10496
lisp/ChangeLog
lisp/progmodes/hideshow.el

index 8cdff58369faf57b4bbb5198e007e78b5d5313bc..ebd76dea18e58756ee91b865eade4e711eab4fa4 100644 (file)
@@ -1,3 +1,8 @@
+2012-04-10  Sébastien Gross  <seb@chezwam.org>  (tiny change)
+
+       * progmodes/hideshow.el (hs-hide-all): Don't infloop on comments
+       that start in the middle of the line (bug#10496).
+
 2012-04-10  Dan Nicolaescu  <dann@gnu.org>
 
        * battery.el (battery-linux-proc-acpi): Only one battery is
index e2016e206a8575933f19c1fdaadf3f88bc40d188..b6d2b5e319cdfdeba073362c29047babfb4cff1e 100644 (file)
@@ -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))