From unknown Tue Sep 23 19:46:21 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#56256 <56256@debbugs.gnu.org> To: bug#56256 <56256@debbugs.gnu.org> Subject: Status: Emacs 28.1 gets stuck when typing some C++ code Reply-To: bug#56256 <56256@debbugs.gnu.org> Date: Wed, 24 Sep 2025 02:46:21 +0000 retitle 56256 Emacs 28.1 gets stuck when typing some C++ code reassign 56256 emacs submitter 56256 Iru Cai severity 56256 normal tag 56256 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Mon Jun 27 08:31:32 2022 Received: (at submit) by debbugs.gnu.org; 27 Jun 2022 12:31:32 +0000 Received: from localhost ([127.0.0.1]:50225 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o5ntr-000731-QH for submit@debbugs.gnu.org; Mon, 27 Jun 2022 08:31:32 -0400 Received: from lists.gnu.org ([209.51.188.17]:60104) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o5lsu-0000h0-17 for submit@debbugs.gnu.org; Mon, 27 Jun 2022 06:22:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41092) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5lst-00025V-S3 for bug-gnu-emacs@gnu.org; Mon, 27 Jun 2022 06:22:23 -0400 Received: from knopi.disroot.org ([178.21.23.139]:47370) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5lsr-0004om-M5 for bug-gnu-emacs@gnu.org; Mon, 27 Jun 2022 06:22:23 -0400 Received: from localhost (localhost [127.0.0.1]) by disroot.org (Postfix) with ESMTP id 397B945AE1 for ; Mon, 27 Jun 2022 12:22:18 +0200 (CEST) X-Virus-Scanned: SPAM Filter at disroot.org Received: from knopi.disroot.org ([127.0.0.1]) by localhost (disroot.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id AnVeoOyrOO4K for ; Mon, 27 Jun 2022 12:22:16 +0200 (CEST) Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail; t=1656325336; bh=4/N1Ggb4/iEIm4L3NzceNDvK9JAvhLoHLCQAm/3VdKg=; h=Date:From:Subject:To; b=JuzQtgNlOk2TytCqe8vv2muiUIZO2wXaR1SkUiakQlqdRtpSFJ+vSoiUc8kmWJ5VT 1H1w1oGoQ38gSj3R9BDXUp1iiju/UxiNt35eaXGxK6NQHs6SGecmu9CTRRkZE9gejM 5CKg1nGufX4UiPQ0AxYG3Zx7XQkkIGg9djWMCSefAV0+TLI7wVtX5u/n4DxCYtv0Xk EZVGLumTm0z9lLJzLaXnr+1B2LCXcaswCBVwGkOAAjtmQx5Ex3iZNNwGd8hdTc2BYp nyZEOFsPGUa229cqjUsxY08BluXFvj/D89V4Ph60ZCAy9riUQcUryWNCSlIthwZCfo N/zl+S/D7Nc/w== Date: Mon, 27 Jun 2022 18:22:15 +0800 Mime-Version: 1.0 From: Iru Cai Subject: Emacs 28.1 gets stuck when typing some C++ code To: bug-gnu-emacs@gnu.org Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=178.21.23.139; envelope-from=vimacs@disroot.org; helo=knopi.disroot.org X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Mon, 27 Jun 2022 08:31:26 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) Emacs gets stuck when trying to type the '&' character at the end of the buffer when there's the following code in C++ mode (this code is from https://www.gingerbill.org/article/2015/08/19/defer-in-cpp/): ``` template struct privDefer {     F f;     privDefer(F f) : f(f) {}     ~privDefer() { f(); } }; template privDefer defer_func(F f) {     return privDefer(f); } #define DEFER_1(x, y) x##y #define DEFER_2(x, y) DEFER_1(x, y) #define DEFER_3(x)    DEFER_2(x, __COUNTER__) #define defer(code) auto DEFER_3(_defer_) = defer_func([ ``` Steps to reproduce: 1. create a C++ source file with this code and open it with Emacs, if the file doesn't have a C++ source suffix, enable c++mode 2. type the '&' symbol at the last line after "defer_func([" 3. then Emacs gets stuck I can see this bug in Emacs 28.1 and git revision 5b1bb1af030597aab7f7895b6e3da9b430f9438a. I've also tried ``emacs -Q`` and ``emacs -Q -nw``, the bug still exists. From debbugs-submit-bounces@debbugs.gnu.org Tue Jun 28 08:53:17 2022 Received: (at 56256) by debbugs.gnu.org; 28 Jun 2022 12:53:17 +0000 Received: from localhost ([127.0.0.1]:54244 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o6AiT-0003FM-B6 for submit@debbugs.gnu.org; Tue, 28 Jun 2022 08:53:17 -0400 Received: from quimby.gnus.org ([95.216.78.240]:48258) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o6AiQ-0003F5-Rv for 56256@debbugs.gnu.org; Tue, 28 Jun 2022 08:53:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=ydHW1L4aGglbY7yfgctMZm615I7twGSvuGoUle3uuq8=; b=amgRLmoUpor/ddMNKo14LBKdax isuNPGOgxKybiHYpU7Ai9j7C7vCybKupvr69pfgDNlK/3rdjPVF4lZwu9xsgqTLmdmfZ3VBP5AsEa qUa9Jdu51M7yE9IiMdVHFG/aZPF7WQKPqQzRDXJvpmPF1MW+4C1ztAeGO1w1P6aajj6Y=; Received: from [84.212.220.105] (helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o6Ai0-0002DP-Nm; Tue, 28 Jun 2022 14:52:58 +0200 From: Lars Ingebrigtsen To: Iru Cai Subject: Re: bug#56256: Emacs 28.1 gets stuck when typing some C++ code References: X-Now-Playing: Namasenda's _PC Music Volume 3_: "Dare (AM)" Date: Tue, 28 Jun 2022 14:52:48 +0200 In-Reply-To: (Iru Cai's message of "Mon, 27 Jun 2022 18:22:15 +0800") Message-ID: <878rphq7a7.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Iru Cai writes: > 1. create a C++ source file with this code and open it with Emacs, if > the file doesn't have a C++ source suffix, enable c++mode > > 2. type the '&' symbol at the last line after "defer_func([" > > [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 56256 Cc: Alan Mackenzie , 56256@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Iru Cai writes: > 1. create a C++ source file with this code and open it with Emacs, if > the file doesn't have a C++ source suffix, enable c++mode > > 2. type the '&' symbol at the last line after "defer_func([" > > 3. then Emacs gets stuck > > I can see this bug in Emacs 28.1 and git revision > 5b1bb1af030597aab7f7895b6e3da9b430f9438a. I've also tried ``emacs -Q`` > and ``emacs -Q -nw``, the bug still exists. Yup -- I can reproduce this on the current trunk, too -- and it hangs Emacs hard: I have to kill Emacs after typing that "&". I'm adding Alan to the CCs. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Tue Jun 28 12:28:40 2022 Received: (at 56256) by debbugs.gnu.org; 28 Jun 2022 16:28:40 +0000 Received: from localhost ([127.0.0.1]:56201 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o6E4t-00036T-Sd for submit@debbugs.gnu.org; Tue, 28 Jun 2022 12:28:40 -0400 Received: from colin.muc.de ([193.149.48.1]:61288 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1o6E4p-00036B-2U for 56256@debbugs.gnu.org; Tue, 28 Jun 2022 12:28:39 -0400 Received: (qmail 71623 invoked by uid 3782); 28 Jun 2022 16:28:28 -0000 Received: from acm.muc.de (p4fe1595e.dip0.t-ipconnect.de [79.225.89.94]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Tue, 28 Jun 2022 18:28:27 +0200 Received: (qmail 7420 invoked by uid 1000); 28 Jun 2022 16:28:27 -0000 Date: Tue, 28 Jun 2022 16:28:27 +0000 To: Iru Cai Subject: Re: bug#56256: Emacs 28.1 gets stuck when typing some C++ code Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Submission-Agent: TMDA/1.3.x (Ph3nix) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 56256 Cc: Lars Ingebrigtsen , 56256@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hello, Iru. Thanks for taking the trouble to report this bug, and thanks even more for such a concise and helpful report. On Mon, Jun 27, 2022 at 18:22:15 +0800, Iru Cai wrote: > Emacs gets stuck when trying to type the '&' character at the end of the > buffer when there's the following code in C++ mode (this code is from > https://www.gingerbill.org/article/2015/08/19/defer-in-cpp/): > ``` > template > struct privDefer { >     F f; >     privDefer(F f) : f(f) {} >     ~privDefer() { f(); } > }; > template > privDefer defer_func(F f) { >     return privDefer(f); > } > #define DEFER_1(x, y) x##y > #define DEFER_2(x, y) DEFER_1(x, y) > #define DEFER_3(x)    DEFER_2(x, __COUNTER__) > #define defer(code) auto DEFER_3(_defer_) = defer_func([ > ``` > Steps to reproduce: > 1. create a C++ source file with this code and open it with Emacs, if > the file doesn't have a C++ source suffix, enable c++mode > 2. type the '&' symbol at the last line after "defer_func([" > 3. then Emacs gets stuck > I can see this bug in Emacs 28.1 and git revision > 5b1bb1af030597aab7f7895b6e3da9b430f9438a. I've also tried ``emacs -Q`` > and ``emacs -Q -nw``, the bug still exists. Yes. What is triggering the bug is the newly typed & being at the end of a #define line. The CC Mode function c-font-lock-c++-lambda-captures is in a loop, handling one lambda capture at a time. At the end of the file, it has just gone forward over the whitespace, and wants to return to the &. However it wrongly uses the function c-backward-token-2, which treats all the macro lines as whitespace, hence ends up at the }, 6 lines earlier. It then searches forward for the "next" [, and ends up at the same one it was at before. This loops infinitely. 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.): 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: -- Alan Mackenzie (Nuremberg, Germany). From debbugs-submit-bounces@debbugs.gnu.org Tue Jun 28 17:04:11 2022 Received: (at control) by debbugs.gnu.org; 28 Jun 2022 21:04:11 +0000 Received: from localhost ([127.0.0.1]:56474 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o6INW-0003dd-SC for submit@debbugs.gnu.org; Tue, 28 Jun 2022 17:04:11 -0400 Received: from mail-pg1-f176.google.com ([209.85.215.176]:43716) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o6INU-0003dM-Mg for control@debbugs.gnu.org; Tue, 28 Jun 2022 17:04:09 -0400 Received: by mail-pg1-f176.google.com with SMTP id 68so13322507pgb.10 for ; Tue, 28 Jun 2022 14:04:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:mime-version:date:message-id:subject:to; bh=UyYpv6PJToMTK+PS2ZUjHN1sFao3ana0APwXlzBok9M=; b=htd7Oiie8qgbfXnWCq4nmciIcSGjiIV6rvG26PucWrlyIwEFWLPh70seH7MnWVFHIr YJhLieGvx2HTz1/FKBiZHqyqm1iykRxWk7uhrreBNGrhMr8oz4qhiG+mSHc0i4PCK0TQ 6SJNrFoWVwwNsNMcq7ebjPSWLDns+rT0fRneAg9x31eJb3Ox/7jnNMmqv1/ytjHIxX+u kEXiumUBZjETdifCZUVTbxqCjk0XUV+9snmgi+3u892c2kU3Ro6AieK6l9ZuyCyFesFc SESC7EmQoZf2S87kATUO3TCRKuW8aa2FUedE9ryHEPE7cxkMrch3+jIVNrOIiV5ZWrVJ /9xw== X-Gm-Message-State: AJIora9eLG9yd1Y/1LrIgSfKSijF/WUc+rGAXmd5XV0cOVAZ1OS3WSUi lZtCefMWheSzxGFBODFdP1yH75GjvTze/V5N7Fjm8KIK X-Google-Smtp-Source: AGRyM1tu12ALIH0wV9vLElbo4GiE2CkSRa9DotF6QJyFqvb+SGtxU+HaMm/doSF5bPUw88/YhUgoh5KxAMcN6a4Q6pM= X-Received: by 2002:a63:2254:0:b0:40d:d291:7710 with SMTP id t20-20020a632254000000b0040dd2917710mr15087776pgm.269.1656450242967; Tue, 28 Jun 2022 14:04:02 -0700 (PDT) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Tue, 28 Jun 2022 14:04:02 -0700 From: Stefan Kangas MIME-Version: 1.0 Date: Tue, 28 Jun 2022 14:04:02 -0700 Message-ID: Subject: control message for bug #56256 To: control@debbugs.gnu.org Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.5 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.5 (/) tags 56256 + patch quit From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 29 03:58:10 2022 Received: (at 56256) by debbugs.gnu.org; 29 Jun 2022 07:58:10 +0000 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 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 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 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) Message-ID: <91fcd136-849d-043f-0c9f-bb0f63fe291f@disroot.org> 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== Date: Wed, 29 Jun 2022 11:03:47 +0800 Mime-Version: 1.0 Subject: Re: bug#56256: Emacs 28.1 gets stuck when typing some C++ code Content-Language: en-US To: Alan Mackenzie References: From: Iru Cai In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 56256 X-Mailman-Approved-At: Wed, 29 Jun 2022 03:58:08 -0400 Cc: Lars Ingebrigtsen , 56256@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) 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: > > From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 02 12:23:24 2022 Received: (at 56256-done) by debbugs.gnu.org; 2 Jul 2022 16:23:24 +0000 Received: from localhost ([127.0.0.1]:42702 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o7fu0-0003co-9J for submit@debbugs.gnu.org; Sat, 02 Jul 2022 12:23:24 -0400 Received: from colin.muc.de ([193.149.48.1]:47755 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1o7ftz-0003ca-32 for 56256-done@debbugs.gnu.org; Sat, 02 Jul 2022 12:23:23 -0400 Received: (qmail 46395 invoked by uid 3782); 2 Jul 2022 16:23:15 -0000 Received: from acm.muc.de (p4fe15928.dip0.t-ipconnect.de [79.225.89.40]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Sat, 02 Jul 2022 18:23:15 +0200 Received: (qmail 23626 invoked by uid 1000); 2 Jul 2022 16:23:15 -0000 Date: Sat, 2 Jul 2022 16:23:15 +0000 To: Iru Cai Subject: Re: bug#56256: Emacs 28.1 gets stuck when typing some C++ code Message-ID: References: <91fcd136-849d-043f-0c9f-bb0f63fe291f@disroot.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <91fcd136-849d-043f-0c9f-bb0f63fe291f@disroot.org> X-Submission-Agent: TMDA/1.3.x (Ph3nix) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 56256-done Cc: acm@muc.de, Lars Ingebrigtsen , 56256-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hello, Iru. On Wed, Jun 29, 2022 at 11:03:47 +0800, Iru Cai wrote: > 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. [ .... ] Thanks for the testing! I've committed the patch to the release branch of our git tree, and I'm closing the bug with this post. -- Alan Mackenzie (Nuremberg, Germany). From unknown Tue Sep 23 19:46:21 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sun, 31 Jul 2022 11:24:09 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator