GNU bug report logs -
#13438
24.2.92; Infinite loop in python imenu support
Previous Next
Reported by: Ivan Andrus <darthandrus <at> gmail.com>
Date: Mon, 14 Jan 2013 21:00:02 UTC
Severity: important
Found in version 24.2.92
Done: Fabián Ezequiel Gallina <fabian <at> anue.biz>
Bug is archived. No further changes may be made.
Full log
Message #28 received at 13438 <at> debbugs.gnu.org (full text, mbox):
Oh, so the actual issue is: if you call
imenu-default-create-index-function with point at the start of the last
defun in the buffer. It goes to point-max, then back to the start of the
defun, and mistakenly thinks it is inflooping.
How about the following, which only signals an error if
imenu-prev-index-position-function returns non-nil twice in a row
without moving point.
BTW, neither python-nav-beginning-of-defun or
python-imenu-prev-index-position will move past the start of the first
defun in a buffer, if the defun begins past point-min (ie, if there are
blank lines before the first defun, it does not move over them to
point-min). I don't know if this matters, but it is inconsistent with eg
Prolog and Emacs Lisp modes.
*** lisp/imenu.el 2013-01-23 21:55:46 +0000
--- lisp/imenu.el 2013-01-27 02:02:39 +0000
***************
*** 678,688 ****
;; 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))
name)
(goto-char (point-max))
;; Search for the function
(while (funcall imenu-prev-index-position-function)
(setq pos (point))
(save-excursion
(setq name (funcall imenu-extract-index-name-function)))
--- 678,690 ----
;; 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)
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)))
This bug report was last modified 12 years and 118 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.