From: Fabian Ezequiel Gallina <galli.87@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Emacs-Devel devel <emacs-devel@gnu.org>
Subject: Re: imenu issue from Bug #13438
Date: Tue, 22 Jan 2013 15:37:40 -0300 [thread overview]
Message-ID: <CABq4mQuXyc-0NSerD-1j39VFRv2KnBvXOFP+c9ydRkyf3p1t2g@mail.gmail.com> (raw)
In-Reply-To: <jwvsj5u3u4a.fsf-monnier+emacs@gnu.org>
2013/1/21 Stefan Monnier <monnier@iro.umontreal.ca>:
>> 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
next prev parent reply other threads:[~2013-01-22 18:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-21 21:09 imenu issue from Bug #13438 Fabian Ezequiel Gallina
2013-01-22 1:07 ` Stefan Monnier
2013-01-22 18:37 ` Fabian Ezequiel Gallina [this message]
2013-01-22 21:08 ` Stefan Monnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CABq4mQuXyc-0NSerD-1j39VFRv2KnBvXOFP+c9ydRkyf3p1t2g@mail.gmail.com \
--to=galli.87@gmail.com \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.