emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: imenu issue from Bug #13438


From: Fabian Ezequiel Gallina
Subject: Re: imenu issue from Bug #13438
Date: Tue, 22 Jan 2013 15:37:40 -0300

2013/1/21 Stefan Monnier <address@hidden>:
>> Here's a mindless quick patch that seems to fix the problem. I could
>> install it myself but I'd like some input first.
>
> Calling beginning-of-defun in such generic code is not an option,
> because this function only works properly in those major modes that set
> it up appropriately.
>
> I think testing bobp makes more sense (and python's function should make
> sure it eventually either returns nil or moves up to bob).
>

bobp is not enough, because I could build an
imenu-prev-index-position-function that returns something even when at
bobp and the infloop would take place. I feel the following fix makes
sense, let me know what do you think.


=== modified file 'lisp/imenu.el'
--- lisp/imenu.el       2013-01-01 09:11:05 +0000
+++ lisp/imenu.el       2013-01-22 18:24:45 +0000
@@ -683,7 +683,14 @@
           (goto-char (point-max))
           ;; Search for the function
           (while (funcall imenu-prev-index-position-function)
-             (when (= pos (point))
+             (when (and (= pos (point))
+                        (= pos
+                           (save-excursion
+                             ;; The infinite loop is true if there's
+                             ;; another index position but point keeps
+                             ;; itself in the same place. bug#13438
+                             (if (funcall imenu-prev-index-position-function)
+                                 (point) 0))))
                (error "Infinite loop at %s:%d:
imenu-prev-index-position-function does not move point" (buffer-name)
pos))
              (setq pos (point))
             (save-excursion



Regards,
Fabián



reply via email to

[Prev in Thread] Current Thread [Next in Thread]