Subject: Re: bug#60427: Emacs-29, c++-ts-mode: typing "char" into an empty buffer causes an exception in redisplay.

From: Yuan Fu <[email-masked]>
Date: Sat, 31 Dec 2022 14:11:03 -0800

> On Dec 31, 2022, at 2:29 AM, Alan Mackenzie <[email-masked]> wrote:
> 
> Hello, Yuan.
> 
> On Fri, Dec 30, 2022 at 22:55:41 -0800, Yuan Fu wrote:
> 
> 
>>> On Dec 30, 2022, at 10:42 PM, Eli Zaretskii <[email-masked]> wrote:
> 
>>>> Cc: [email-masked]
>>>> From: Yuan Fu <[email-masked]>
>>>> Date: Fri, 30 Dec 2022 17:02:36 -0800
> 
>>>> Thank you! I couldn’t reproduce it on the latest trunk
> 
>>> AFAIU, the report was about the emacs-29 branch, not about the master
>>> branch.  So what did you mean by "latest trunk" above?
> 
>> Sorry, imprecise wording, I mean latest emacs-29 :-)
> 
> I've just downloaded the latest commits in the emacs-29 branch,
> bootstrapped, and I still see the problem, both in X GUI and on a Linux
> console.  Just as a matter of interest, I get the error after typing the
> h in "char", so the problem would appear not to be related to the
> specific character string "char".
> 
> As you mentioned, the backtrace now looks a bit different, namely:
> 
>  debug-early-backtrace()
>  treesit-font-lock-fontify-region(1 5 nil)
>  font-lock-default-fontify-region(1 5 nil)
>  font-lock-fontify-region(1 5)
>  #f(compiled-function (fun) #<bytecode -0x156e29a3e4e81ac3>)(font-lock-fontify-region)
>  jit-lock--run-functions(1 5)
>  jit-lock-fontify-now(1 5)
>  jit-lock-function(1)
>  redisplay_internal\ \(C\ function\)()
> 
> 
> I forgot to give my configuration arguments, maybe that has something to
> do with it.  They're:
> 
>  ./configure --with-gif=no --with-tiff=no --with-gpm --with-native-compilation
> 
> ..

As Eli observed, this seems like a mismatch between the C++ language grammar you used and the queries used by c++-ts-mode. We need to pin down or declare the version of the language grammar a major mode is written on. Maybe in NEWS file?

Yuan