aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSam Steingold2010-01-11 15:53:23 -0500
committerSam Steingold2010-01-11 15:53:23 -0500
commitd8b8451f8ea52d751035449278ec36c3e598f9cf (patch)
tree9cb59bcd796de4c54d625aa0e4b4fa903918ca5c
parent30afcdfffd95e24183956a666749cf6c03150d14 (diff)
downloademacs-d8b8451f8ea52d751035449278ec36c3e598f9cf.tar.gz
emacs-d8b8451f8ea52d751035449278ec36c3e598f9cf.zip
(imenu-default-create-index-function): Detect infinite
loops caused by imenu-prev-index-position-function.
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/imenu.el7
2 files changed, 10 insertions, 2 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 51687a04553..f8248d837b1 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12010-01-11 Sam Steingold <sds@gnu.org>
2
3 * imenu.el (imenu-default-create-index-function): Detect infinite
4 loops caused by imenu-prev-index-position-function.
5
12010-01-11 Juanma Barranquero <lekktu@gmail.com> 62010-01-11 Juanma Barranquero <lekktu@gmail.com>
2 7
3 * htmlfontify.el (htmlfontify-load-rgb-file) 8 * htmlfontify.el (htmlfontify-load-rgb-file)
diff --git a/lisp/imenu.el b/lisp/imenu.el
index 77035c602d8..47c99ad1997 100644
--- a/lisp/imenu.el
+++ b/lisp/imenu.el
@@ -596,7 +596,7 @@ See `imenu--index-alist' for the format of the index alist."
596;;; Find all markers in alist and makes 596;;; Find all markers in alist and makes
597;;; them point nowhere. 597;;; them point nowhere.
598;;; The top-level call uses nil as the argument; 598;;; The top-level call uses nil as the argument;
599;;; non-nil arguments are in recursivecalls. 599;;; non-nil arguments are in recursive calls.
600(defvar imenu--cleanup-seen) 600(defvar imenu--cleanup-seen)
601 601
602(defun imenu--cleanup (&optional alist) 602(defun imenu--cleanup (&optional alist)
@@ -684,12 +684,15 @@ The alternate method, which is the one most often used, is to call
684 ;; in these major modes. But save that change for later. 684 ;; in these major modes. But save that change for later.
685 (cond ((and imenu-prev-index-position-function 685 (cond ((and imenu-prev-index-position-function
686 imenu-extract-index-name-function) 686 imenu-extract-index-name-function)
687 (let ((index-alist '()) 687 (let ((index-alist '()) (pos (point))
688 prev-pos name) 688 prev-pos name)
689 (goto-char (point-max)) 689 (goto-char (point-max))
690 (imenu-progress-message prev-pos 0 t) 690 (imenu-progress-message prev-pos 0 t)
691 ;; Search for the function 691 ;; Search for the function
692 (while (funcall imenu-prev-index-position-function) 692 (while (funcall imenu-prev-index-position-function)
693 (when (= pos (point))
694 (error "Infinite loop at %s:%d: imenu-prev-index-position-function does not move point" (buffer-name) pos))
695 (setq pos (point))
693 (imenu-progress-message prev-pos nil t) 696 (imenu-progress-message prev-pos nil t)
694 (save-excursion 697 (save-excursion
695 (setq name (funcall imenu-extract-index-name-function))) 698 (setq name (funcall imenu-extract-index-name-function)))