From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Iru Cai via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#56256: Emacs 28.1 gets stuck when typing some C++ code Date: Wed, 29 Jun 2022 11:03:47 +0800 Message-ID: <91fcd136-849d-043f-0c9f-bb0f63fe291f@disroot.org> References: Reply-To: Iru Cai Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11884"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Lars Ingebrigtsen , 56256@debbugs.gnu.org To: Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jun 29 09:59:14 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o6SbR-0002qy-Hj for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 29 Jun 2022 09:59:13 +0200 Original-Received: from localhost ([::1]:51994 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o6SbQ-0003Mh-63 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 29 Jun 2022 03:59:12 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43512) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o6SbI-0003LL-HK for bug-gnu-emacs@gnu.org; Wed, 29 Jun 2022 03:59:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:34998) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o6SbG-0002YD-GE for bug-gnu-emacs@gnu.org; Wed, 29 Jun 2022 03:59:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1o6SbG-0001UR-F2 for bug-gnu-emacs@gnu.org; Wed, 29 Jun 2022 03:59:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Iru Cai Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 29 Jun 2022 07:59:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56256 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 56256-submit@debbugs.gnu.org id=B56256.16564894905628 (code B ref 56256); Wed, 29 Jun 2022 07:59:02 +0000 Original-Received: (at 56256) by debbugs.gnu.org; 29 Jun 2022 07:58:10 +0000 Original-Received: from localhost ([127.0.0.1]:57125 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o6SaP-0001Sf-Lp for submit@debbugs.gnu.org; Wed, 29 Jun 2022 03:58:10 -0400 Original-Received: from knopi.disroot.org ([178.21.23.139]:43280) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o6Nzc-0002Ip-Rm for 56256@debbugs.gnu.org; Tue, 28 Jun 2022 23:03:53 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by disroot.org (Postfix) with ESMTP id 32EC545A99; Wed, 29 Jun 2022 05:03:51 +0200 (CEST) X-Virus-Scanned: SPAM Filter at disroot.org Original-Received: from knopi.disroot.org ([127.0.0.1]) by localhost (disroot.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id s-Onv7hKsrlE; Wed, 29 Jun 2022 05:03:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail; t=1656471830; bh=XLgchDbEysLYtvvjJ1oCtY7nV2+X6g4PRTzbaxeu4Do=; h=Date:Subject:To:Cc:References:From:In-Reply-To; b=X6PMCeI3K3UE0gYWn7wBefe+hBXCxIdT+6sEvuwZDtQkOJD7Nuw5kkisB9xulpigC Q/+SuKIwOuwwI7DkrVnWhIlAyU1VQDuPfIOmv82Epp1BiNrcx7d6Ci5gMCRT3CmcCj imuVuayF1dK89F9E/LaG6knPQzsppfEkabyEooqB1I2xCLcqfm2OatztJ8UbBRo3Cj bWzUe8cdnAqkJ84SZcYgrzHAo6KV3v1FzVv3BitPKQx72KtlRMW7fevy5Q5XJK1tAh 2q/lPysx9Dc42yNtidEMtUmCVO6HDBQ0HRFbAXv5dqcM/8Yo/xrI5GMBKUOpmmOU83 FHFS4cX4kZf4w== Content-Language: en-US In-Reply-To: X-Mailman-Approved-At: Wed, 29 Jun 2022 03:58:08 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:235600 Archived-At: On 2022/6/29 00:28, Alan Mackenzie wrote: > I think the following patch should fix it. Could you try it out on your > real C++ code, please, and tell us whether the bug is actually fixed. > (If you want any help with applying the patch or byte compiling CC Mode > afterwards, feel free to send me private email.): Thanks, this fixes this bug, and I haven't found a issue when editing some of my C++ code. > diff -r 03c932b2922b cc-fonts.el > --- a/cc-fonts.el Sat Jun 18 15:40:47 2022 +0000 > +++ b/cc-fonts.el Tue Jun 28 16:15:37 2022 +0000 > @@ -1823,7 +1823,7 @@ > ;; font-lock-keyword-face. It always returns NIL to inhibit this and > ;; prevent a repeat invocation. See elisp/lispref page "Search-based > ;; Fontification". > - (let (mode capture-default id-start id-end declaration sub-begin sub-end) > + (let (mode capture-default id-start id-end declaration sub-begin sub-end tem) > (while (and (< (point) limit) > (search-forward "[" limit t)) > (when (progn (backward-char) > @@ -1835,15 +1835,18 @@ > (char-after))) > ;; Is the first element of the list a bare "=" or "&"? > (when mode > - (forward-char) > - (c-forward-syntactic-ws) > - (if (memq (char-after) '(?, ?\])) > - (progn > - (setq capture-default mode) > - (when (eq (char-after) ?,) > - (forward-char) > - (c-forward-syntactic-ws))) > - (c-backward-token-2))) > + (setq tem nil) > + (save-excursion > + (forward-char) > + (c-forward-syntactic-ws) > + (if (memq (char-after) '(?, ?\])) > + (progn > + (setq capture-default mode) > + (when (eq (char-after) ?,) > + (forward-char) > + (c-forward-syntactic-ws)) > + (setq tem (point))))) > + (if tem (goto-char tem))) > > ;; Go round the following loop once per captured item. We use "\\s)" > ;; rather than "\\]" here to avoid infinite looping in this situation: > >