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: Tue, 7 Jan 2020 10:09:49 +0800 Message-ID: References: <66aa470b-7c40-4eeb-ba54-1af0adf1fc50@Spark> <20200106180757.GA8917@ACM> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="5e13e873_1f48eaa1_b145" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="251096"; mail-complaints-to="usenet@blaine.gmane.org" 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: Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Jan 07 03:11:26 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 1ioeL7-0013BP-N6 for geb-bug-gnu-emacs@m.gmane.org; Tue, 07 Jan 2020 03:11:26 +0100 Original-Received: from localhost ([::1]:38350 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioeL6-0003Jc-Aw for geb-bug-gnu-emacs@m.gmane.org; Mon, 06 Jan 2020 21:11:24 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51254) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioeKo-0003G2-Qy for bug-gnu-emacs@gnu.org; Mon, 06 Jan 2020 21:11:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ioeKl-0006Cg-AP for bug-gnu-emacs@gnu.org; Mon, 06 Jan 2020 21:11:05 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:41116) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ioeKk-00069B-CC; Mon, 06 Jan 2020 21:11:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ioeKk-0001eX-3j; Mon, 06 Jan 2020 21:11:02 -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: Tue, 07 Jan 2020 02:11: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.15783630146291 (code B ref 38749); Tue, 07 Jan 2020 02:11:02 +0000 Original-Received: (at 38749) by debbugs.gnu.org; 7 Jan 2020 02:10:14 +0000 Original-Received: from localhost ([127.0.0.1]:47089 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ioeJx-0001dN-HG for submit@debbugs.gnu.org; Mon, 06 Jan 2020 21:10:13 -0500 Original-Received: from mail-oln040092255080.outbound.protection.outlook.com ([40.92.255.80]:30594 helo=APC01-HK2-obe.outbound.protection.outlook.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ioeJu-0001d1-CN for 38749@debbugs.gnu.org; Mon, 06 Jan 2020 21:10:12 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nBNYMPrwIbYeo5ZUaI0VykPTe6FVwKlM437bG6BLARF4vFLOl/SSaUuIdqUKtj+SqLXaGOevoKQI8vixrpq8NZhcUogOuDTtDdVZJR7o4snBLqrTXfZZn31bcXEPTuZnrp5RqIxGEBGoZP/DWjHhPMtXHsLX74jbSFPJ96mVwadEXhG13cmAWVIUa7W7sYmC2wvVuCSt4OtMxJLwfzDtvQiXyfEza6P2K8tPqGGdw25cXyyyc07qhCWrwt+QZ4ZaOwyykwkwi2gp0XyUAzfXsgkRa8vyim8q3Q6hp0yjS2ogKQZaSETRfl4dlqFN+BRw4Bv4nmVftHMSk0BKL32Jsw== 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=htJf8xnmtpgGqvs1QcWETrjL3tYQI3rbJCgXXCVQBTo=; b=CyYGmieq2TQF1zYfsFru3rlmmQaFk84szKvT+Xpoq2c8y/0XuayVzRTipikmBrgWNDaO+92hHx/uiuNn6R/y9EAdq6L/gK3OQtOc/4vBLWL2QkDbgaFiS3nW1QlUWd3xjmo/uYa8S+X2boS6+XNKHkdo5p7nO+EbU36T7skTXVHppCdX1J4JxLvhgvQyY2xn2aS8H96xzKwlpLlvyPoilT0VncgIdd5lQYCp42NDMQjy07Ej1x3DHLdpUon4+SZPtkay2slBPSk/6A+cdsGPTzecNGC5boj9pO8EIs2ti5e5yl4MPWTOLRpUglOGVt592fd6IaYm7XTUHX0rECAoCQ== 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=htJf8xnmtpgGqvs1QcWETrjL3tYQI3rbJCgXXCVQBTo=; b=JVB6mB05rBCX/3C5eoOp7HKtUKYdcPj/qKokMvnde3uOBxJn2kFpnaXyg9OFtLuxsHPxivx5X2scR7S2R+YrPEvoM/3t6u1W538HvCclvEGMo+qtPaNzguQ3esGaXA+Uvo1Z+KslD9OgB4QMC53mO0s2yiRs0yz0yzpJkOvDSOoNfZGYxNdst8yuPqv9mlsJ9rNmNyoWsPjIoU9qK0ef658p0s1r2cTVewwd7W+Cv6yNEXQGWNhLulg4P2Tw2bpG3FqM2WzrIA5nI+V11S0pjO6IBFPqJY4H+bQYuKb0OZli0VMy3gk6rWWhyyZDrNbfC8W4lkKxRMYbB7ptLWlrtw== Original-Received: from HK2APC01FT031.eop-APC01.prod.protection.outlook.com (10.152.248.55) by HK2APC01HT069.eop-APC01.prod.protection.outlook.com (10.152.249.225) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2602.11; Tue, 7 Jan 2020 02:10:00 +0000 Original-Received: from PS1PR03MB3606.apcprd03.prod.outlook.com (10.152.248.51) by HK2APC01FT031.mail.protection.outlook.com (10.152.248.189) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2602.11 via Frontend Transport; Tue, 7 Jan 2020 02:10:00 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:A05957C9DD18F56B82AD36AE2E2EA748127CC5671BFE0D1C6067E7EADDEDCA27; UpperCasedChecksum:331549E0933498AE07EC387E72EA5645867975B40EB7CF2DF407FE0A73EA1BEF; SizeAsReceived:8933; 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; Tue, 7 Jan 2020 02:09:59 +0000 In-Reply-To: <20200106180757.GA8917@ACM> X-Readdle-Message-ID: 04acd9ae-5df1-486e-9fb4-1d11b1a02be2@Spark X-ClientProxiedBy: HK2PR0302CA0013.apcprd03.prod.outlook.com (2603:1096:202::23) To PS1PR03MB3606.apcprd03.prod.outlook.com (2603:1096:803:4e::17) X-Microsoft-Original-Message-ID: <04acd9ae-5df1-486e-9fb4-1d11b1a02be2@Spark> Original-Received: from [192.168.1.103] (1.196.184.176) by HK2PR0302CA0013.apcprd03.prod.outlook.com (2603:1096:202::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2623.4 via Frontend Transport; Tue, 7 Jan 2020 02:09:57 +0000 X-Readdle-Message-ID: 04acd9ae-5df1-486e-9fb4-1d11b1a02be2@Spark X-Microsoft-Original-Message-ID: <04acd9ae-5df1-486e-9fb4-1d11b1a02be2@Spark> X-TMN: [YeazECb+LSUtsEntVF8EYp0JsW2O74zD] X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 48 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: c95625af-a94f-472d-c5f4-08d79316b2b0 X-MS-TrafficTypeDiagnostic: HK2APC01HT069: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NRhCsVJIP6tPdNa6IxWEF3Er3yXF6zHByJAgZNlFfNkwGAc0OWVP1qS6hdrdwYoOyiz6/XTvFQaJArb7IdP+h2nyE7CuDPFcZ3tYUYVjQP9GdP4AOZPe4z0api8Zb1PdeB2j5uqmKQIn7yX04x0NBZB6ixyN4YG+UXjMeTVZWAagG1zustncS5wwJ8by1i82 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: c95625af-a94f-472d-c5f4-08d79316b2b0 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jan 2020 02:09:59.6005 (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: HK2APC01HT069 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:174280 Archived-At: --5e13e873_1f48eaa1_b145 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline =E5=9C=A8 2020=E5=B9=B41=E6=9C=887=E6=97=A5 +0800 AM2:08=EF=BC=8CAlan Mac= kenzie =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 s= o > 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. > 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, scanni= ng > the freshly visited Objc buffer currently takes 0.0196s. With the check= > for comments/strings, it takes 0.0650s. > > That's a factor of =7E3.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'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: static Lisp=5FObject interpret=5Fservices=5Fmenu (NSMenu *menu, Lisp=5FObject prefix, Lisp=5FO= bject 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 trackin= g 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 --5e13e873_1f48eaa1_b145 Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline
=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, but haven't committed the fix yet.


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'm not familiar with objc. What about searching the char= '{' after the current pattern? But then I see the following snippet in nsf= ns.m:

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 */
{


--5e13e873_1f48eaa1_b145--