Merge from emacs-24; up to 2012-12-12T22:29:54Z!yamaoka@jpl.org
[bpt/emacs.git] / lisp / imenu.el
index ba02750..435d97f 100644 (file)
@@ -678,11 +678,13 @@ 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 (point))
+        (let ((index-alist '()) (pos -1)
               name)
           (goto-char (point-max))
           ;; Search for the function
           (while (funcall imenu-prev-index-position-function)
+             (when (= pos (point))
+               (error "Infinite loop at %s:%d: imenu-prev-index-position-function does not move point" (buffer-name) pos))
              (setq pos (point))
             (save-excursion
               (setq name (funcall imenu-extract-index-name-function)))