GNU bug report logs - #56256
Emacs 28.1 gets stuck when typing some C++ code

Previous Next

Package: emacs;

Reported by: Iru Cai <vimacs <at> disroot.org>

Date: Mon, 27 Jun 2022 12:32:02 UTC

Severity: normal

Tags: patch

Done: Alan Mackenzie <acm <at> muc.de>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Iru Cai <vimacs <at> disroot.org>
To: Alan Mackenzie <acm <at> muc.de>
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>, 56256 <at> 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
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:
>
>




This bug report was last modified 3 years and 55 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.