unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Iru Cai via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Alan Mackenzie <acm@muc.de>
Cc: Lars Ingebrigtsen <larsi@gnus.org>, 56256@debbugs.gnu.org
Subject: bug#56256: Emacs 28.1 gets stuck when typing some C++ code
Date: Wed, 29 Jun 2022 11:03:47 +0800	[thread overview]
Message-ID: <91fcd136-849d-043f-0c9f-bb0f63fe291f@disroot.org> (raw)
In-Reply-To: <YrssK5a1vujVR1v9@ACM>


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:
>
>





  reply	other threads:[~2022-06-29  3:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-27 10:22 bug#56256: Emacs 28.1 gets stuck when typing some C++ code Iru Cai via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-28 12:52 ` Lars Ingebrigtsen
2022-06-28 16:28 ` Alan Mackenzie
2022-06-29  3:03   ` Iru Cai via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2022-07-02 16:23     ` Alan Mackenzie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=91fcd136-849d-043f-0c9f-bb0f63fe291f@disroot.org \
    --to=bug-gnu-emacs@gnu.org \
    --cc=56256@debbugs.gnu.org \
    --cc=acm@muc.de \
    --cc=larsi@gnus.org \
    --cc=vimacs@disroot.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).