* imenu.el (imenu-default-create-index-function):
authorGlenn Morris <rgm@gnu.org>
Fri, 1 Feb 2013 08:23:47 +0000 (00:23 -0800)
committerGlenn Morris <rgm@gnu.org>
Fri, 1 Feb 2013 08:23:47 +0000 (00:23 -0800)
Tweak infinite loop test to check for forward motion as well as none.

lisp/ChangeLog
lisp/imenu.el

index a05d0fc..e2bb42b 100644 (file)
@@ -1,3 +1,8 @@
+2013-02-01  Glenn Morris  <rgm@gnu.org>
+
+       * imenu.el (imenu-default-create-index-function):
+       Tweak infinite loop test to check for forward motion as well as none.
+
 2013-02-01  Alex Harsanyi  <AlexHarsanyi@gmail.com>
 
        * net/soap-client.el (soap-invoke): Encode the string for
index 80fc441..c1077a4 100644 (file)
@@ -676,12 +676,12 @@ The alternate method, which is the one most often used, is to call
   ;; in these major modes.  But save that change for later.
   (cond ((and imenu-prev-index-position-function
              imenu-extract-index-name-function)
-        (let ((index-alist '()) (pos -1)
+        (let ((index-alist '()) (pos (point-max))
               name)
-          (goto-char (point-max))
+          (goto-char pos)
           ;; Search for the function
           (while (funcall imenu-prev-index-position-function)
-             (when (= pos (point))
+             (unless (< (point) pos)
                (error "Infinite loop at %s:%d: imenu-prev-index-position-function does not move point" (buffer-name) pos))
              (setq pos (point))
             (save-excursion