unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Glenn Morris <rgm@gnu.org>
To: "Fabián Ezequiel Gallina" <fabian@anue.biz>
Cc: 13438@debbugs.gnu.org
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	[thread overview]
Message-ID: <v6bocb8jbx.fsf@fencepost.gnu.org> (raw)
In-Reply-To: <51028EED.30406@anue.biz> ("Fabián Ezequiel Gallina"'s message of "Fri, 25 Jan 2013 10:55:57 -0300")


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)))






      reply	other threads:[~2013-01-27  2:12 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
2013-01-27  2:12         ` Glenn Morris [this message]

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=v6bocb8jbx.fsf@fencepost.gnu.org \
    --to=rgm@gnu.org \
    --cc=13438@debbugs.gnu.org \
    --cc=fabian@anue.biz \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).