From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: owner@emacsbugs.donarmstrong.com (Emacs bug Tracking System) Newsgroups: gmane.emacs.bugs Subject: bug#3153: marked as done (23.0.60; which-func-mode (C++) confused when mixing structs/functions (patch included)) Date: Tue, 28 Apr 2009 21:40:06 +0000 Message-ID: References: <87ws94pise.fsf@cyd.mit.edu> <87d4awwpej.fsf@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----------=_1240954806-25697-0" X-Trace: ger.gmane.org 1240955536 22838 80.91.229.12 (28 Apr 2009 21:52:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 28 Apr 2009 21:52:16 +0000 (UTC) To: Chong Yidong Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Apr 28 23:52:06 2009 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LyvDh-00071U-Jp for geb-bug-gnu-emacs@m.gmane.org; Tue, 28 Apr 2009 23:52:06 +0200 Original-Received: from localhost ([127.0.0.1]:53900 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LyvDg-0003Tv-T5 for geb-bug-gnu-emacs@m.gmane.org; Tue, 28 Apr 2009 17:52:04 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LyvDb-0003RR-29 for bug-gnu-emacs@gnu.org; Tue, 28 Apr 2009 17:51:59 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LyvDW-0003P0-G2 for bug-gnu-emacs@gnu.org; Tue, 28 Apr 2009 17:51:58 -0400 Original-Received: from [199.232.76.173] (port=60211 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LyvDW-0003Ox-96 for bug-gnu-emacs@gnu.org; Tue, 28 Apr 2009 17:51:54 -0400 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:50651) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LyvDV-0006T2-Dw for bug-gnu-emacs@gnu.org; Tue, 28 Apr 2009 17:51:53 -0400 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n3SLppjA029230; Tue, 28 Apr 2009 14:51:51 -0700 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.13.8/8.13.8/Submit) id n3SLe6M0025788; Tue, 28 Apr 2009 14:40:06 -0700 X-Mailer: MIME-tools 5.420 (Entity 5.420) X-Loop: owner@emacsbugs.donarmstrong.com X-Emacs-PR-Message: closed 3153 X-Emacs-PR-Package: emacs X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:27520 Archived-At: This is a multi-part message in MIME format... ------------=_1240954806-25697-0 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Your message dated Tue, 28 Apr 2009 17:31:13 -0400 with message-id <87ws94pise.fsf@cyd.mit.edu> and subject line Re: 23.0.60; which-func-mode (C++) confused when mixing st= ructs/functions (patch included) has caused the Emacs bug report #3153, regarding 23.0.60; which-func-mode (C++) confused when mixing structs/funct= ions (patch included) to be marked as done. This means that you claim that the problem has been dealt with. If this is not the case it is now your responsibility to reopen the bug report if necessary, and/or fix the problem forthwith. (NB: If you are a system administrator and have no idea what this message is talking about, this may indicate a serious mail system misconfiguration somewhere. Please contact owner@emacsbugs.donarmstrong.com immediately.) --=20 3153: http://emacsbugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=3D3153 Emacs Bug Tracking System Contact owner@emacsbugs.donarmstrong.com with problems ------------=_1240954806-25697-0 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by emacsbugs.donarmstrong.com; 28 Apr 2009 19:26:37 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=0.0 required=4.0 tests=MURPHY_DRUGS_REL8 autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from fencepost.gnu.org (fencepost.gnu.org [140.186.70.10]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n3SJQXKZ024839 for ; Tue, 28 Apr 2009 12:26:34 -0700 Received: from mx10.gnu.org ([199.232.76.166]:50577) by fencepost.gnu.org with esmtp (Exim 4.67) (envelope-from ) id 1Lyswq-0003hq-M6 for emacs-pretest-bug@gnu.org; Tue, 28 Apr 2009 15:26:32 -0400 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1Lyswp-0007N3-Ir for emacs-pretest-bug@gnu.org; Tue, 28 Apr 2009 15:26:32 -0400 Received: from mail-ew0-f162.google.com ([209.85.219.162]:53867) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Lyswp-0007Mt-4A for emacs-pretest-bug@gnu.org; Tue, 28 Apr 2009 15:26:31 -0400 Received: by ewy6 with SMTP id 6so851977ewy.42 for ; Tue, 28 Apr 2009 12:26:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:subject:date :message-id:mime-version:content-type; bh=CewMJPPjfTnbCvspyT4TwmgiFdeuy07TZqKKTnn33Tk=; b=hzq+wsccSVD7T+ZuMwVCJQtTY2xzwx/WpsQl8tAsVvo7v9hM4U/KgvJFwOHIYaLnEp 9pbJTrQn9msIvIWM0CdPl5op71XavpWMCK0QenF5vaH3tWSJw8jSdJwWJWYUX76EyNm1 Lk/MIM4QGIFjY5MnD2h+GfcnHOOUehhcfxlLc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:subject:date:message-id:mime-version:content-type; b=T0WXV1nxzlKLYRXuCPjKHjKCBPqB4PUcRTkW6vKYS+jr7Yd8YiK+l9d48ZwiFiV4lv ldSreDTjXzF0HRf0//ET76F2iFMofbNTpTUFvdpGm7ZMeqK2UPawAta7gZdR9zPRBmP/ hKfWjxyPgw/qbNkE8NNeH3uwmTpK0lQiDddn8= Received: by 10.210.126.18 with SMTP id y18mr5597701ebc.56.1240946789530; Tue, 28 Apr 2009 12:26:29 -0700 (PDT) Received: from geert-laptop (ip204-230-210-87.adsl2.static.versatel.nl [87.210.230.204]) by mx.google.com with ESMTPS id 10sm348039eyd.2.2009.04.28.12.26.28 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 28 Apr 2009 12:26:29 -0700 (PDT) From: Geert Kloosterman To: emacs-pretest-bug@gnu.org Subject: 23.0.60; which-func-mode (C++) confused when mixing structs/functions (patch included) Date: Tue, 28 Apr 2009 21:26:28 +0200 Message-ID: <87d4awwpej.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) --=-=-= In GNU Emacs 23.0.60.1 (i686-pc-linux-gnu, GTK+ Version 2.12.0) of 2008-11-26 on geert-laptop Windowing system distributor `The X.Org Foundation', version 11.0.10300000 When a C/C++ file contains mixed struct/function definitions, which-func-mode gets confused. To reproduce (see also the comments in the test case file): 1. open the test case file whichfunc-testcase.cpp 2. make sure which-func-mode is enabled (M-x which-func-mode) 3. put the point within the funcA() definition 4. the modeline shows "structA", not the expected "funcA" In the following I'll describe the problem in somewhat more detail. In `which-function()' it is assumed that the entries from `imenu--index-alist' are ordered by buffer possition. `which-function()' does a linear search through the items, and as soon as a buffer position is encountered greater than point, the search stops. However, when submenu's are present in `imenu--index-alist', the items are not necessarily ordered by buffer position anymore: For the testcase the imenu--index-alist variable looks like this: (("Class" ("structA" . #) ("structB" . #)) ("funcA" . #) ("funcB" . #)) The attached patch ensures the linear search through `menu--index-alist does not end prematurely, and all items are taken into account. This fixes the problem. --=-=-= Content-Type: text/x-c++src Content-Disposition: inline; filename=whichfunc-testcase.cpp /* test case for which-func-mode (GJK 2009-04-28) Tested against the following revision: Repository revision: 1.26 /cvsroot/emacs/emacs/lisp/progmodes/which-func.el,v The imenu--index-alist variable looks like this: (("Class" ("structA" . #) ("structB" . #)) ("funcA" . #) ("funcB" . #)) Because of the submenu, the overall items are not in order. */ struct structA { int i; }; void funcA() { // here the modeline will still show "structA" dummy; } struct structB { int i; }; void funcB() { dummy; } --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=which-func.patch Index: which-func.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/progmodes/which-func.el,v retrieving revision 1.26 diff -c -r1.26 which-func.el *** which-func.el 5 Jan 2009 03:23:54 -0000 1.26 --- which-func.el 28 Apr 2009 19:13:57 -0000 *************** *** 310,319 **** (setq minoffset offset name (funcall which-func-imenu-joiner-function ! (reverse (cons (car pair) namestack))))) ! ;; Entries in order, so can skip all those after point. ! (setq alist nil ! imstack nil))))) (setq alist (car imstack) namestack (cdr namestack) --- 310,317 ---- (setq minoffset offset name (funcall which-func-imenu-joiner-function ! (reverse (cons (car pair) ! namestack))))))))) (setq alist (car imstack) namestack (cdr namestack) --=-=-= Best regards, Geert Kloosterman --=-=-=-- ------------=_1240954806-25697-0 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 3153-done) by emacsbugs.donarmstrong.com; 28 Apr 2009 21:31:13 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=0.0 required=4.0 tests=MURPHY_DRUGS_REL8 autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from cyd.mit.edu (CYD.MIT.EDU [18.115.2.24]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n3SLVAJh024340 for <3153-done@emacsbugs.donarmstrong.com>; Tue, 28 Apr 2009 14:31:11 -0700 Received: by cyd.mit.edu (Postfix, from userid 1000) id 3391057E25C; Tue, 28 Apr 2009 17:31:13 -0400 (EDT) From: Chong Yidong To: Geert Kloosterman Cc: 3153-done@emacsbugs.donarmstrong.com Subject: Re: 23.0.60; which-func-mode (C++) confused when mixing structs/functions (patch included) Date: Tue, 28 Apr 2009 17:31:13 -0400 Message-ID: <87ws94pise.fsf@cyd.mit.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii > When a C/C++ file contains mixed struct/function definitions, > which-func-mode gets confused. Thanks for analyzing this problem, and fixing it. I've committed your patch. ------------=_1240954806-25697-0--