From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Zhang Haijun Newsgroups: gmane.emacs.bugs Subject: bug#35316: 26.2; Emacs lags in c++-mode buffer when editing with iedit-mode on Date: Fri, 19 Apr 2019 00:32:34 +0000 Message-ID: References: <5A24EADA-D920-4E1D-8CAE-511A6A74588C@outlook.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="_004_PS1PR06MB2759795CDC5AFD9D6E41780FA8270PS1PR06MB2759apcp_" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="10024"; mail-complaints-to="usenet@blaine.gmane.org" To: "35316@debbugs.gnu.org" <35316@debbugs.gnu.org> Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Apr 19 02:42:48 2019 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.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hHHc7-0002To-9M for geb-bug-gnu-emacs@m.gmane.org; Fri, 19 Apr 2019 02:42:47 +0200 Original-Received: from localhost ([127.0.0.1]:49206 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hHHc6-0007jI-6N for geb-bug-gnu-emacs@m.gmane.org; Thu, 18 Apr 2019 20:42:46 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:35712) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hHHbv-0007cN-0a for bug-gnu-emacs@gnu.org; Thu, 18 Apr 2019 20:42:36 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hHHSh-0006pe-BP for bug-gnu-emacs@gnu.org; Thu, 18 Apr 2019 20:33:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:57489) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hHHSg-0006pI-Ou for bug-gnu-emacs@gnu.org; Thu, 18 Apr 2019 20:33:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hHHSg-0007YA-K0 for bug-gnu-emacs@gnu.org; Thu, 18 Apr 2019 20:33:02 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: Resent-From: Zhang Haijun Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 19 Apr 2019 00:33:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 35316 X-GNU-PR-Package: emacs Original-Received: via spool by 35316-submit@debbugs.gnu.org id=B35316.155563396528988 (code B ref 35316); Fri, 19 Apr 2019 00:33:02 +0000 Original-Received: (at 35316) by debbugs.gnu.org; 19 Apr 2019 00:32:45 +0000 Original-Received: from localhost ([127.0.0.1]:42799 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hHHSP-0007XU-JF for submit@debbugs.gnu.org; Thu, 18 Apr 2019 20:32:45 -0400 Original-Received: from mail-oln040092254017.outbound.protection.outlook.com ([40.92.254.17]:46809 helo=APC01-PU1-obe.outbound.protection.outlook.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hHHSO-0007XF-1I for 35316@debbugs.gnu.org; Thu, 18 Apr 2019 20:32:44 -0400 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=+TwUQtFR+h8dbHS0MpB62mPhXGxP1U+7aKx5nFjZjls=; b=O7tk//34qF1DO9LjyEsD0sPIXddAnAcdtxSzs7O4cdJc89OtogydscHGEfUpRThSv/bhuu3av5vxVfTcli6XWFdGh6Uh4/Vla/jg67Hr7+YU59yd2LG4ZA+FKKsMQTDPePi+ckolNyeaxzQny3YC2LQQvdXH88tnHkDq3DyzwqGJVXJphds/Ar6Suj0HyMD9WtXhgWcNyuzFw+0t3xkhAL5IpiI633BdvCkD6r/lj9N/TOQWXZLntaNVmmgr41GmBml5QyKU4hqlrtJ5h1tUUSySUL9if5GySIOi7h0ovTg7UV3Ht07NxiodemqwgLJiogZVEOUboj4CbAo/fgOuDw== Original-Received: from SG2APC01FT050.eop-APC01.prod.protection.outlook.com (10.152.250.51) by SG2APC01HT127.eop-APC01.prod.protection.outlook.com (10.152.251.43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1771.16; Fri, 19 Apr 2019 00:32:35 +0000 Original-Received: from PS1PR06MB2759.apcprd06.prod.outlook.com (10.152.250.56) by SG2APC01FT050.mail.protection.outlook.com (10.152.251.238) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1771.16 via Frontend Transport; Fri, 19 Apr 2019 00:32:35 +0000 Original-Received: from PS1PR06MB2759.apcprd06.prod.outlook.com ([fe80::b5a7:335c:7ed:4ab1]) by PS1PR06MB2759.apcprd06.prod.outlook.com ([fe80::b5a7:335c:7ed:4ab1%6]) with mapi id 15.20.1792.021; Fri, 19 Apr 2019 00:32:34 +0000 Thread-Topic: 26.2; Emacs lags in c++-mode buffer when editing with iedit-mode on Thread-Index: AQHU9kdhfQXib1heyEOMRFlaO2+ugA== Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: yes x-clientproxiedby: HK2PR02CA0138.apcprd02.prod.outlook.com (2603:1096:202:16::22) To PS1PR06MB2759.apcprd06.prod.outlook.com (2603:1096:803:46::13) x-incomingtopheadermarker: OriginalChecksum:0BDBE7A623DC4AAF657DEAE97EC0E683EEFCBB5F0DC24D0AA668448EE09837B9; UpperCasedChecksum:49C0C5B9C11923AC4A96704AF9C76B0D2FA8AEAB77E6DF6ECCB2ECBAEFB5B2BB; SizeAsReceived:7369; Count:48 x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: Apple Mail (2.3445.9.1) x-tmn: [15Q7BRuasj6TT+LzXmCXX2WUkx+YJw2n] x-microsoft-original-message-id: x-ms-publictraffictype: Email x-incomingheadercount: 48 x-eopattributedmessage: 0 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(5050001)(7020095)(20181119110)(201702061078)(5061506573)(5061507331)(1603103135)(2017031320274)(2017031323274)(2017031324274)(2017031322404)(1601125500)(1603101475)(1701031045); SRVR:SG2APC01HT127; x-ms-traffictypediagnostic: SG2APC01HT127: x-ms-exchange-purlcount: 1 x-microsoft-antispam-message-info: Jol2NDN+abx2/6bQGNYqObeA+llCTYRX1TBlZHAHKCaPyE/7ZHMGNyHuYSm4+nESbcHo7d0Gd3txxC2X9eSIJcWBiF0wePwmzd9UaY4dB4lFgp3czPT/muveDrVa40gGIlVGddr1vvAIDaxjikb/FgDaCjjJeUi0oQYYdYRRe7esltByPMdnqJB7mqUOMawA X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: 452b985b-6365-44b9-9ebc-08d6c45e8282 X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Apr 2019 00:32:34.4783 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: SG2APC01HT127 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:157814 Archived-At: --_004_PS1PR06MB2759795CDC5AFD9D6E41780FA8270PS1PR06MB2759apcp_ Content-Type: multipart/alternative; boundary="_000_PS1PR06MB2759795CDC5AFD9D6E41780FA8270PS1PR06MB2759apcp_" --_000_PS1PR06MB2759795CDC5AFD9D6E41780FA8270PS1PR06MB2759apcp_ Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 DQpSZXByb2R1Y2luZyBzdGVwczoNCjEuIGVtYWNzIC1RDQoyLiBFdmFsIGNvZGU6IChhZGQtdG8t bGlzdCAncGFja2FnZS1hcmNoaXZlcyAnKCJtZWxwYSIgLiAiaHR0cHM6Ly9tZWxwYS5vcmcvcGFj a2FnZXMv4oCcKSkNCjMuIGluc3RhbGwgdGhlIHBhY2thZ2UgaWVkaXQgKHZlcnNpb24gZnJvbSBt ZWxwYSkNCjQuIG9wZW4gdGhlIGF0dGFjaG1lbnQgYysrIGZpbGUsIGFuZCBnb3RvIGxpbmUgMjYy IGFuZCBjb2x1bW4gMTcuIGN1cnNvciB3aWxsIGJlIG9uIHdvcmQg4oCcc3Vic2Vzc2lvbiINCjUu IE0teCBuYXJyb3ctdG8tZGVmdW4NCjYuIE0teCBpZWRpdC1tb2RlDQo3LiBNLXggd2lkZW4NCjgu IFlvdSB3aWxsIHNlZSB0aGUgbGFnIHdoZW4gaW5wdXR0aW5nIGNoYXJzLg0KDQoNCg0KDQo= --_000_PS1PR06MB2759795CDC5AFD9D6E41780FA8270PS1PR06MB2759apcp_ Content-Type: text/html; charset="utf-8" Content-ID: <394C7A34D6AF7F4AB9CC500DD9F14672@apcprd06.prod.outlook.com> Content-Transfer-Encoding: base64 PGh0bWw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U6 MTFwdDsiPg0KPGRpdiBjbGFzcz0iUGxhaW5UZXh0Ij48YnI+DQo8YnI+DQo8YnI+DQo8L2Rpdj4N Cjwvc3Bhbj48L2ZvbnQ+PC9kaXY+DQo8L2JvZHk+DQo8L2h0bWw+DQo= --_000_PS1PR06MB2759795CDC5AFD9D6E41780FA8270PS1PR06MB2759apcp_-- --_004_PS1PR06MB2759795CDC5AFD9D6E41780FA8270PS1PR06MB2759apcp_ Content-Type: application/octet-stream; name="QuickTimeFileSink.cpp" Content-Description: QuickTimeFileSink.cpp Content-Disposition: attachment; filename="QuickTimeFileSink.cpp"; size=85068; creation-date="Fri, 19 Apr 2019 00:32:34 GMT"; modification-date="Fri, 19 Apr 2019 00:32:34 GMT" Content-ID: Content-Transfer-Encoding: base64 LyoqKioqKioqKioNClRoaXMgbGlicmFyeSBpcyBmcmVlIHNvZnR3YXJlOyB5b3UgY2FuIHJlZGlz dHJpYnV0ZSBpdCBhbmQvb3IgbW9kaWZ5IGl0IHVuZGVyDQp0aGUgdGVybXMgb2YgdGhlIEdOVSBM ZXNzZXIgR2VuZXJhbCBQdWJsaWMgTGljZW5zZSBhcyBwdWJsaXNoZWQgYnkgdGhlDQpGcmVlIFNv ZnR3YXJlIEZvdW5kYXRpb247IGVpdGhlciB2ZXJzaW9uIDMgb2YgdGhlIExpY2Vuc2UsIG9yIChh dCB5b3VyDQpvcHRpb24pIGFueSBsYXRlciB2ZXJzaW9uLiAoU2VlIDxodHRwOi8vd3d3LmdudS5v cmcvY29weWxlZnQvbGVzc2VyLmh0bWw+LikNCg0KVGhpcyBsaWJyYXJ5IGlzIGRpc3RyaWJ1dGVk IGluIHRoZSBob3BlIHRoYXQgaXQgd2lsbCBiZSB1c2VmdWwsIGJ1dCBXSVRIT1VUDQpBTlkgV0FS UkFOVFk7IHdpdGhvdXQgZXZlbiB0aGUgaW1wbGllZCB3YXJyYW50eSBvZiBNRVJDSEFOVEFCSUxJ VFkgb3IgRklUTkVTUw0KRk9SIEEg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