]> code.delx.au - gnu-emacs/blobdiff - lisp/imenu.el
* imenu.el (imenu-default-create-index-function):
[gnu-emacs] / lisp / imenu.el
index 80fc441c896a97e9f9ce94ca540e8ce37d5711d2..c1077a49d1a08d23643b77918639438ecd35e668 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