From: "Fabián Ezequiel Gallina" <fabian@anue.biz>
To: Glenn Morris <rgm@gnu.org>
Cc: 13438@debbugs.gnu.org
Subject: bug#13438: /srv/bzr/emacs/emacs-24 r111196: * imenu.el (imenu-default-create-index-function): Remove useless
Date: Fri, 25 Jan 2013 10:55:57 -0300 [thread overview]
Message-ID: <51028EED.30406@anue.biz> (raw)
In-Reply-To: <g2ip6lu0cy.fsf@fencepost.gnu.org>
[-- Attachment #1: Type: text/plain, Size: 1927 bytes --]
On 01/25/2013 05:34 AM, Glenn Morris wrote:
>>> Why is this issue (apparently) only seen in Python mode
> Answering my own question, it happens in any mode that sets
> imenu-prev-index-position-function and
> imenu-extract-index-name-function, but there are very few of those.
>
> Eg prolog mode. With buffer contents:
>
> ------
> fac(0,1).
> fac(N,F) :- N > 0, M is N - 1,
> fac(M,Fm), F is N * Fm.
> ------
>
> and point at point-min, switching to prolog-mode causes the same issue.
>
> How about taking the more cautious approach with:
>
> (when (and (= pos (point))
> (not (bobp)))
> (error "Infinite loop... ))
>
> (IIUC, this was actually the suggestion in
> http://lists.gnu.org/archive/html/emacs-devel/2013-01/msg00510.html ?)
I ran into the same thing, and checking bobp is not enough, try adding a
newline at the beginning of file to the recipe and call imenu with point
at beginning of defun and you'll see the infinite error check will trigger.
I proposed the following patch that works:
=== 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))))
But finally after some mails with Stefan we decided the best thing will
be to remove this check altogether.
[-- Attachment #2: Type: text/html, Size: 3440 bytes --]
next prev parent reply other threads:[~2013-01-25 13:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <E1Ty8dP-0000cA-TK@vcs.savannah.gnu.org>
2013-01-24 18:01 ` bug#13438: /srv/bzr/emacs/emacs-24 r111196: * imenu.el (imenu-default-create-index-function): Remove useless Glenn Morris
2013-01-24 18:30 ` Stefan Monnier
2013-01-25 8:34 ` Glenn Morris
2013-01-25 13:55 ` Fabián Ezequiel Gallina [this message]
2013-01-27 2:12 ` Glenn Morris
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=51028EED.30406@anue.biz \
--to=fabian@anue.biz \
--cc=13438@debbugs.gnu.org \
--cc=rgm@gnu.org \
/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.