summaryrefslogtreecommitdiff
path: root/lisp/imenu.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/imenu.el')
-rw-r--r--lisp/imenu.el4
1 files changed, 3 insertions, 1 deletions
diff --git a/lisp/imenu.el b/lisp/imenu.el
index ba0275099a1..435d97fcdb4 100644
--- a/lisp/imenu.el
+++ b/lisp/imenu.el
@@ -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)))