[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#13438: /srv/bzr/emacs/emacs-24 r111196: * imenu.el (imenu-default-cr
From: |
Glenn Morris |
Subject: |
bug#13438: /srv/bzr/emacs/emacs-24 r111196: * imenu.el (imenu-default-create-index-function): Remove useless |
Date: |
Sat, 26 Jan 2013 21:12:50 -0500 |
User-agent: |
Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) |
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)))