From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: HaiJun Zhang Newsgroups: gmane.emacs.bugs Subject: bug#38749: 27.0.50; objc-mode: wrong imenu item Date: Wed, 8 Jan 2020 12:03:32 +0800 Message-ID: References: <66aa470b-7c40-4eeb-ba54-1af0adf1fc50@Spark> <20200106180757.GA8917@ACM> <20200107205357.GA21795@ACM> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="5e15549a_100f8fca_b145" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="256214"; mail-complaints-to="usenet@blaine.gmane.org" Cc: 38749@debbugs.gnu.org To: Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Jan 08 05:15:45 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 1ip2jd-000ltM-Kl for geb-bug-gnu-emacs@m.gmane.org; Wed, 08 Jan 2020 05:14:22 +0100 Original-Received: from localhost ([::1]:35800 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ip2jc-0002GG-F9 for geb-bug-gnu-emacs@m.gmane.org; Tue, 07 Jan 2020 23:14:20 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33473) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ip2Zj-0003jA-4T for bug-gnu-emacs@gnu.org; Tue, 07 Jan 2020 23:04:09 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ip2Zh-0001l9-Gb for bug-gnu-emacs@gnu.org; Tue, 07 Jan 2020 23:04:07 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:43698) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ip2Ze-0001g6-1c; Tue, 07 Jan 2020 23:04:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ip2Zd-0000ig-SQ; Tue, 07 Jan 2020 23:04:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: HaiJun Zhang Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Wed, 08 Jan 2020 04:04: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.15784562352753 (code B ref 38749); Wed, 08 Jan 2020 04:04:01 +0000 Original-Received: (at 38749) by debbugs.gnu.org; 8 Jan 2020 04:03:55 +0000 Original-Received: from localhost ([127.0.0.1]:49671 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ip2ZX-0000iK-0T for submit@debbugs.gnu.org; Tue, 07 Jan 2020 23:03:55 -0500 Original-Received: from mail-oln040092254080.outbound.protection.outlook.com ([40.92.254.80]:13136 helo=APC01-PU1-obe.outbound.protection.outlook.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ip2ZT-0000i5-RB for 38749@debbugs.gnu.org; Tue, 07 Jan 2020 23:03:53 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fj1hAq8vZ/ZQTnfDnrgL6Fklf9ny+i11WxS8e76MioNPF3RmX7jXTW0T1eNgvtAGwIoPK6xzkXEiXOnJfsXCUdk6qWUFvpWMT5/DEjH6IA4kEbwSgxoKEzYJmDBqlattmPc2+JGVZBytS+vxVOJBoz77HV28tsnWJECGcwE/dDfGuZcYlX2fo3MUh7goVeCySDb3PilEWJTEIBduvARqOsQEdMB7/iu/REo1KqHw8BFR3g/IxYNkW7dtXCzsmxwDG5l5Da20BHpgBwy/2e+h8DVKasTPNWVQA4aOSr/r2o6RBjS6YKnKFsaNDy67nq1oDnO7Je2+Lp9tgNFc+P8Efg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Fdcvrxjb2Lgql4nLRVTEWIevag9cymbVmQMIyskO7qU=; b=ecW8fbuyqD/g26M4uJeQRWVB79ga1m55K2vkH/fHtWXhWYaFYLi6cMgYLcRKpBI7rrBp+dxNd22LFUwQvtz6DkDOt06XFT1tqDiWTDuIxqgTW8KkBbZuQSDkenxceYt9CtghBhCpj/Ck22Zg+hhMWhHIMe1SA4y4S01NHxUojvZiyLFdFWvmDbzPkIm+GGjGOU2t6Kekas8KKiOy4Ks7dOZU6uWwtGTugB+5aIaP88f7mRwqIEEMdywl07F3Uo05HmSR1AtZbkqATOPTxvkO8/ssSyz8zUTRUQbTrk1ATteriFWqwUX/8a9IiA/XzvGpT2UUF7REyqgOAdek2pcloQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=outlook.com; dmarc=pass action=none header.from=outlook.com; dkim=pass header.d=outlook.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Fdcvrxjb2Lgql4nLRVTEWIevag9cymbVmQMIyskO7qU=; b=BqClvwIss4K4HBJB/I9EQTvI6qhG0CnY9jPnxptiTqSKqsR05iO0sWXImuItrI/mATBTtKfYAbFtJHr8qo8McgNy00OkUVEQP2EOCJqchmD+3hhJ7YQcDg8KCwvX5MOX3DFWOH6+zfpahOzL+6r+8oHsi/60YK2DkXLXN0CoEMbF1dnbfQ65c9U2bNaL66FBLw0SSX0SexIhVYc5B7l/c5aWyxB5mwDdBIgkO6ZALZ0HPKy6dftlXQDQcFEKeiMT3PZ1XmSJYRKseKwfYubBa7MZS58lu3RKDhMl0c/l2F/Cq/0IhWqpJ0MsELZfOzlNgpzkHrZsdkFC4yxmFj1LPQ== Original-Received: from HK2APC01FT035.eop-APC01.prod.protection.outlook.com (10.152.248.60) by HK2APC01HT081.eop-APC01.prod.protection.outlook.com (10.152.249.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2602.11; Wed, 8 Jan 2020 04:03:43 +0000 Original-Received: from PS1PR03MB3606.apcprd03.prod.outlook.com (10.152.248.54) by HK2APC01FT035.mail.protection.outlook.com (10.152.248.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2602.11 via Frontend Transport; Wed, 8 Jan 2020 04:03:43 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:4D5782629DEC4E9E1706E4C9BBBCE50D1235AA0EFC862233FE0438C2DD20441F; UpperCasedChecksum:05C193EAE0FF6BB78533A4A7B392B79D13AFD84AAFBA0E745A66F56AA6C80B4C; SizeAsReceived:8969; Count:48 Original-Received: from PS1PR03MB3606.apcprd03.prod.outlook.com ([fe80::b470:80bc:efed:9117]) by PS1PR03MB3606.apcprd03.prod.outlook.com ([fe80::b470:80bc:efed:9117%7]) with mapi id 15.20.2623.008; Wed, 8 Jan 2020 04:03:43 +0000 In-Reply-To: <20200107205357.GA21795@ACM> X-Readdle-Message-ID: 2d2874d0-8799-4044-9341-5710f7ca90a4@Spark X-ClientProxiedBy: HK2PR0401CA0012.apcprd04.prod.outlook.com (2603:1096:202:2::22) To PS1PR03MB3606.apcprd03.prod.outlook.com (2603:1096:803:4e::17) X-Microsoft-Original-Message-ID: <2d2874d0-8799-4044-9341-5710f7ca90a4@Spark> Original-Received: from [192.168.1.103] (1.196.184.176) by HK2PR0401CA0012.apcprd04.prod.outlook.com (2603:1096:202:2::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2602.12 via Frontend Transport; Wed, 8 Jan 2020 04:03:42 +0000 X-Readdle-Message-ID: 2d2874d0-8799-4044-9341-5710f7ca90a4@Spark X-Microsoft-Original-Message-ID: <2d2874d0-8799-4044-9341-5710f7ca90a4@Spark> X-TMN: [br325SEQitGbzoJZE+zXL1/fF0fQfNsE] X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 48 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 0fe8e7ff-dccb-48e4-4bf9-08d793efc079 X-MS-TrafficTypeDiagnostic: HK2APC01HT081: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FkaTaulXg1BEIiWAryrED09pX7XDJ2G4pIfSVQiME7j5jxPcNIJUsEzozQPWG5bp1LOzZS/fSKpEts1EgDmmIv0qR6Mp5iP/cPRtPvmi5IBdJC0OGXcSEFD/urXupHJ1kPUPco/arN/17ZsYFg9bSkBK5eEjLflQISXH9KqHu8KKAOEy4DeH28UIMs1sptXQ X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0fe8e7ff-dccb-48e4-4bf9-08d793efc079 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jan 2020 04:03:43.5563 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: HK2APC01HT081 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:174357 Archived-At: --5e15549a_100f8fca_b145 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline I tried. It is fixed. Thanks. =E5=9C=A8 2020=E5=B9=B41=E6=9C=888=E6=97=A5 +0800 AM4:54=EF=BC=8CAlan Mac= kenzie =EF=BC=8C=E5=86=99=E9=81=93=EF=BC=9A > Hello, HaiJun. > > On Tue, Jan 07, 2020 at 10:09:49 +0800, HaiJun Zhang wrote: > > =E5=9C=A8 2020=E5=B9=B41=E6=9C=887=E6=97=A5 +0800 AM2:08=EF=BC=8CAlan= Mackenzie =EF=BC=8C=E5=86=99=E9=81=93=EF=BC=9A > > > 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 =22Wrong > > > type argument: stringp, nil=22. > > > > 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 > > > =22Copyright (C)=22) 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=C2=BD year old Ryzen machine, sc= anning > > > the freshly visited Objc buffer currently takes 0.0196s. With the c= heck > > > for comments/strings, it takes 0.0650s. > > > > That's a factor of =7E3.25 slower. On a slower machine (factor 3) w= ith 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 lit= tle. > > I tried the timings again this evening, and I no longer see this factor= > of =7E3 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 '=7B' after= > > the current pattern=3F But then I see the following snippet in nsfns.= m: > > This isn't needed any more > > > static Lisp=5FObject > > interpret=5Fservices=5Fmenu (NSMenu *menu, Lisp=5FObject prefix, Lisp= =5FObject old) > > /* =E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2= =80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80= =94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94= =E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2= =80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94 > > =C2=A0 =C2=A0Turn the input menu (an NSMenu) into a lisp list for tra= cking on lisp side. > > =C2=A0 =C2=A0=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2= =80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80= =94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94= =E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2= =80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94 */ > > =7B > > Could I ask you to try out the new code, and if everything's OK, we can= > close the bug as fixed. > > Thanks=21 > > -- > Alan Mackenzie (Nuremberg, Germany). --5e15549a_100f8fca_b145 Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline
I tried. It is fixed. Thanks.
=E5=9C=A8 2020=E5=B9=B41=E6=9C=888=E6=97= =A5 +0800 AM4:54=EF=BC=8CAlan Mackenzie <acm@muc.de>=EF=BC=8C=E5= =86=99=E9=81=93=EF=BC=9A
Hello, HaiJun.

On Tue, Jan 07, 2020 at 10:09:49 +0800, HaiJun Zhang wrote:
=E5=9C=A8 2020=E5=B9= =B41=E6=9C=887=E6=97=A5 +0800 AM2:08=EF=BC=8CAlan Mackenzie <acm@muc= .de>=EF=BC=8C=E5=86=99=E9=81=93=EF=BC=9A
I've just spent some t= ime 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 <tab> C <tab> 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, b= ut 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 - cle= arly 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 ea= sy
enough to fix, by checking for comments and strings, but comes with a
fairly stiff time penalty. On my 2=C2=BD 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)=
/* =E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94= =E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2= =80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80= =94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94= =E2=80=94=E2=80=94=E2=80=94=E2=80=94
   Turn the input menu (an NSMenu) into a lisp list for tracking = on lisp side.
   =E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80= =94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94= =E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2= =80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80= =94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94 */
{

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).
--5e15549a_100f8fca_b145--