From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#38749: 27.0.50; objc-mode: wrong imenu item Date: Mon, 6 Jan 2020 18:07:57 +0000 Message-ID: <20200106180757.GA8917@ACM> References: <66aa470b-7c40-4eeb-ba54-1af0adf1fc50@Spark> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="124191"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mutt/1.10.1 (2018-07-13) Cc: for@acm.muc.de, Bug@acm.muc.de, Emanuel@acm.muc.de, Emacs@acm.muc.de, 38749@debbugs.gnu.org, reports@acm.muc.de, GNU@acm.muc.de, Berg@acm.muc.de, via@acm.muc.de To: HaiJun Zhang Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jan 06 19:09:15 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1ioWoR-000W5p-KC for geb-bug-gnu-emacs@m.gmane.org; Mon, 06 Jan 2020 19:09:11 +0100 Original-Received: from localhost ([::1]:57506 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioWoQ-00022M-Br for geb-bug-gnu-emacs@m.gmane.org; Mon, 06 Jan 2020 13:09:10 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40985) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioWoK-0001zS-T1 for bug-gnu-emacs@gnu.org; Mon, 06 Jan 2020 13:09:05 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ioWoJ-0005Py-Pa for bug-gnu-emacs@gnu.org; Mon, 06 Jan 2020 13:09:04 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:40696) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ioWoI-0005OK-48; Mon, 06 Jan 2020 13:09:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ioWoI-0001hh-0G; Mon, 06 Jan 2020 13:09:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Mon, 06 Jan 2020 18:09:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 38749 X-GNU-PR-Package: emacs,cc-mode Original-Received: via spool by 38749-submit@debbugs.gnu.org id=B38749.15783340856476 (code B ref 38749); Mon, 06 Jan 2020 18:09:01 +0000 Original-Received: (at 38749) by debbugs.gnu.org; 6 Jan 2020 18:08:05 +0000 Original-Received: from localhost ([127.0.0.1]:46669 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ioWnN-0001gO-IV for submit@debbugs.gnu.org; Mon, 06 Jan 2020 13:08:05 -0500 Original-Received: from colin.muc.de ([193.149.48.1]:61533 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1ioWnL-0001gE-Ej for 38749@debbugs.gnu.org; Mon, 06 Jan 2020 13:08:04 -0500 Original-Received: (qmail 55609 invoked by uid 3782); 6 Jan 2020 18:08:01 -0000 Original-Received: from acm.muc.de (p4FE15CA6.dip0.t-ipconnect.de [79.225.92.166]) by colin.muc.de (tmda-ofmipd) with ESMTP; Mon, 06 Jan 2020 19:08:00 +0100 Original-Received: (qmail 9143 invoked by uid 1000); 6 Jan 2020 18:07:57 -0000 Content-Disposition: inline In-Reply-To: X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:174254 Archived-At: Hello, HaiJun. On Thu, Dec 26, 2019 at 18:31:55 +0800, HaiJun Zhang wrote: > In GNU Emacs 27.0.50 (build 1, x86_64-apple-darwin17.7.0, NS appkit-1561.61 Version 10.13.6 (Build 17G10021)) >  of 2019-12-23 built on jundeMac > Repository revision: 3ee8ee8476fef2a5e8159f7597e36e0953295ce2 > Repository branch: mod > Windowing system distributor ‘Apple', version 10.3.1561 > System Description: Mac OS X 10.13.6 > Open file nsfns.m in emacs source(src/nsfns.m). Many imenu items are invalid. > For example, “C/Copyright” and some more are in the header comment. I've just spent some time fixing a more serious bug in the Objective-C imenu mechanism. This only occurs when I invoke imenu through the keyboard (e.g. with M-x imenu), which might explain why it's survived so long without detection. If I invoke imenu with a mouse click, it works. Anyhow, with nsfns.m, do M-x imenu C and select any item. This works. Now do M-x imenu. This throws the error "Wrong type argument: stringp, nil". I've fixed this now, but haven't committed the fix yet. Back to your bug - clearly what is happening is that the regular expression search for functions is finding things in comments (such as "Copyright (C)") which look like functions but aren't. This is easy enough to fix, by checking for comments and strings, but comes with a fairly stiff time penalty. On my 2½ year old Ryzen machine, scanning the freshly visited Objc buffer currently takes 0.0196s. With the check for comments/strings, it takes 0.0650s. That's a factor of ~3.25 slower. On a slower machine (factor 3) with a larger file (factor 3) this could mean the scanning would take 0.6s rather than 0.2s. This might be slow enough to annoy somebody a little. Getting spurious entries in the index, like "Copyright" also is clearly annoying, otherwise you wouldn't have submitted the bug report. So please give me a little time to decide which annoyance is the more important. Sorry! -- Alan Mackenzie (Nuremberg, Germany).