Subject: bug#73877: 30; rust-ts-mode: highlight the possible type suffix of number literals

From: Randy Taylor <[email-masked]>
Date: Fri, 15 Nov 2024 00:11:54 +0000

On Monday, November 11th, 2024 at 07:32, Christophe TROESTLER <[email-masked]> wrote:
> 
> 
> 
> Thanks Eli Zaretskii and Randy Taylor for your remarks. An undated patch is attached.
> 
> On 2 November 2024 at 20:48 +01, Randy Taylor [email-masked] wrote:
> 
> > […] Unless I am missing something, the variables should reset
> > automatically. They are only changed in the context of the test.
> > 
> > How are you running them that you are seeing otherwise?
> 
> 
> I now am using the command line but, if I evaluate the tests (C-xC-e) and then run them with M-x ert, the variable 'rust-ts-mode-fontify-number-suffix-as-type' is not reset to its original value.
> 
> Best,
> C.

Ah, sorry. I had only tried with treesit-font-lock-level myself since
the patch didn't apply cleanly for me and I didn't have a chance to
manually apply it, and I glossed over how the variables are set
differently. If you do the same as treesit-font-lock-level, i.e.,
place it in the let instead of setq, then it will reset properly.
You will also need to: (require 'rust-ts-mode)
After you make that change, I think you should be able to get rid of
this:
+(put 'rust-ts-mode-fontify-number-suffix-as-type 'safe-local-variable
+     'booleanp)

In the font-lock-number.rs file, it looks like there is an extraneous
newline at the top of the file.

BTW the current patch still doesn't apply against the latest master
for me.