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: Tue, 7 Jan 2020 20:53:57 +0000 Message-ID: <20200107205357.GA21795@ACM> References: <66aa470b-7c40-4eeb-ba54-1af0adf1fc50@Spark> <20200106180757.GA8917@ACM> 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="204122"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mutt/1.10.1 (2018-07-13) Cc: 38749@debbugs.gnu.org To: HaiJun Zhang Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Jan 07 21:55:13 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 1iovsd-000kcq-4h for geb-bug-gnu-emacs@m.gmane.org; Tue, 07 Jan 2020 21:55:11 +0100 Original-Received: from localhost ([::1]:55942 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iovsb-0004Ed-Vn for geb-bug-gnu-emacs@m.gmane.org; Tue, 07 Jan 2020 15:55:10 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40329) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iovsW-0004D4-58 for bug-gnu-emacs@gnu.org; Tue, 07 Jan 2020 15:55:05 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iovsV-0001WW-1o for bug-gnu-emacs@gnu.org; Tue, 07 Jan 2020 15:55:04 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:43488) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iovsU-0001VT-U0; Tue, 07 Jan 2020 15:55:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iovsU-0005Su-H7; Tue, 07 Jan 2020 15:55: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: Tue, 07 Jan 2020 20:55:02 +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.157843044320916 (code B ref 38749); Tue, 07 Jan 2020 20:55:02 +0000 Original-Received: (at 38749) by debbugs.gnu.org; 7 Jan 2020 20:54:03 +0000 Original-Received: from localhost ([127.0.0.1]:49458 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iovrX-0005RH-Ck for submit@debbugs.gnu.org; Tue, 07 Jan 2020 15:54:03 -0500 Original-Received: from colin.muc.de ([193.149.48.1]:55901 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1iovrV-0005Qq-Fg for 38749@debbugs.gnu.org; Tue, 07 Jan 2020 15:54:02 -0500 Original-Received: (qmail 34308 invoked by uid 3782); 7 Jan 2020 20:53:59 -0000 Original-Received: from acm.muc.de (p4FE15923.dip0.t-ipconnect.de [79.225.89.35]) by colin.muc.de (tmda-ofmipd) with ESMTP; Tue, 07 Jan 2020 21:53:57 +0100 Original-Received: (qmail 21802 invoked by uid 1000); 7 Jan 2020 20:53: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:174348 Archived-At: Hello, HaiJun. On Tue, Jan 07, 2020 at 10:09:49 +0800, HaiJun Zhang wrote: > 在 2020年1月7日 +0800 AM2:08,Alan Mackenzie ,写道: > > 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. It turns out, that bug had been fixed in the Emacs core version of CC Mode back in 2012. ;-) > Thanks. > > 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. I tried the timings again this evening, and I no longer see this factor of ~3 slowdown. In fact just a few 10s of percent. So I've committed this fix, both to standalone CC Mode and the emacs-27 branch at savannah (from where it will soon find its way to the master branch). > I'm not familiar with objc. What about searching the char '{' after > the current pattern? But then I see the following snippet in nsfns.m: This isn't needed any more > static Lisp_Object > interpret_services_menu (NSMenu *menu, Lisp_Object prefix, Lisp_Object old) > /* ————————————————————————————————————— >    Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side. >    ————————————————————————————————————— */ > { Could I ask you to try out the new code, and if everything's OK, we can close the bug as fixed. Thanks! -- Alan Mackenzie (Nuremberg, Germany).