From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Fabian Ezequiel Gallina Newsgroups: gmane.emacs.devel Subject: Re: imenu issue from Bug #13438 Date: Tue, 22 Jan 2013 15:37:40 -0300 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1358880354 28226 80.91.229.3 (22 Jan 2013 18:45:54 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 22 Jan 2013 18:45:54 +0000 (UTC) Cc: Emacs-Devel devel To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jan 22 19:46:10 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TxirH-0003fB-7v for ged-emacs-devel@m.gmane.org; Tue, 22 Jan 2013 19:46:07 +0100 Original-Received: from localhost ([::1]:33187 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Txir0-0003JS-5z for ged-emacs-devel@m.gmane.org; Tue, 22 Jan 2013 13:45:50 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:45531) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Txiqy-0003JM-4p for emacs-devel@gnu.org; Tue, 22 Jan 2013 13:45:49 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Txiqw-00030L-Bm for emacs-devel@gnu.org; Tue, 22 Jan 2013 13:45:48 -0500 Original-Received: from mail-ie0-f177.google.com ([209.85.223.177]:63124) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Txiqw-0002zz-1a for emacs-devel@gnu.org; Tue, 22 Jan 2013 13:45:46 -0500 Original-Received: by mail-ie0-f177.google.com with SMTP id k13so11816814iea.8 for ; Tue, 22 Jan 2013 10:45:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type:content-transfer-encoding; bh=/NgAKF6W9VasmoqNt7KdftInYvxHVueBSMuUzMiV2Yg=; b=rfD2VhKJVGu7lQGlLp9on1rSaRk6UBvQ8eTXhU9hF+qGJ7RqR2oc2nQEiiYily1+mq DKxR5qAPEd05yHOJsYPR5E0+8A8E4hoEJI+fO2Jg4dmwdyva3e70kzcHrQ7215P3ZaXl 95hhwkl3O+KlzrvemxmyyLksJ9SfYs8mhgQUMmjN3bQBkDapwqWZRkVl+8p9mTJEz++K HTF0K2LSoJqWoq7lzfenEIbp2GiPaHHF9Adp/eRN3X0cafMpxl5icgWkzwfvu5JgMjo0 mBQHU2E7da0kd1VLePuzlkwYfCtOPkBYUweTbzNqZ8KqDxld2jfNi8FeW7xjvOqP0wNG j0hA== X-Received: by 10.50.152.194 with SMTP id va2mr12870328igb.25.1358879860706; Tue, 22 Jan 2013 10:37:40 -0800 (PST) Original-Received: by 10.64.9.143 with HTTP; Tue, 22 Jan 2013 10:37:40 -0800 (PST) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.223.177 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:156586 Archived-At: 2013/1/21 Stefan Monnier : >> 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. =3D=3D=3D 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 (=3D pos (point)) + (when (and (=3D pos (point)) + (=3D 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-functi= on) + (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=E1n