Subject: Re: bug#78892: [PATCH] Fix yaml-ts-mode comment-start-skip to improve commenting/uncommenting

From: James Cherti <[email-masked]>
Date: Wed, 25 Jun 2025 14:19:10 -0400

Hello Juri,

For some reason, "#+\s-*" causes issues with commenting and
uncommenting, whereas "#+ *" does not.

The pattern "#+ *" is sufficient for YAML, as the YAML
specification disallows tabs and permits only spaces.

--
James Cherti
GitHub: https://github.com/jamescherti
Website: https://www.jamescherti.com/

On 2025-06-25 13:13, Juri Linkov wrote:
>> As demonstrated, some block items starting with '-' remain
>> commented, causing inconsistent comment handling in YAML
>> indented blocks.
>>
>> This patch ensures the entire comment line, including
>> leading '-' characters, is properly toggled by modifying
>> the comment-start-skip regular expression.
> 
>> -    (setq-local comment-start-skip "#+\\s-*")
>> +    (setq-local comment-start-skip "#+ *")
> 
> Since yaml-mode uses "#+ *", yaml-ts-mode could use the same.
> So this patch could be pushed for compatibility with yaml-mode.
> 
> But I really don't see a difference between "#+\\s-*" and "#+ *".
> One matches any whitespace, and another just the space character.
> I don't understand how this could affect block items starting with '-'.
> While trying your test case, I can't reproduce the problem:
> everything is uncommented correctly.
> 
> 
>