Subject: Re: bug#77746: [PATCH] sh-mode: Fix incorrect word syntax for punctuation in sh-mode

From: Dmitry Gutov <[email-masked]>
Date: Thu, 17 Apr 2025 02:29:53 +0300

On 15/04/2025 03:23, Stefan Monnier via Bug reports for GNU Emacs, the 
Swiss army knife of text editors wrote:
>> For context: I have been using the syntax table introduced
>> by this patch for over a year in extensive Bash scripting (I
>> write hundreds of Bash scripts annually), and I have not
>> encountered any issues with `sh-mode` or `bash-ts-mode` when
>> this patch is applied.
> It's possible that your patch is actually safe.
> 
> Someone™ just needs to take a close look at the syntax-propertize,
> font-lock, and indentation code to assess the potential effects (I think
> it's the only two cases that deserve such close scrutiny, because other
> cases are usually more like dabbrev in the sense that there isn't as
> clear a "right-vs-wrong" distinction).
> 
> Another option, might be to combine your patch with another patch which
> sets the syntax-table used for font-lock, indentation, and syntax-ppss.

To point out a more advanced solution: if the character constituents for 
variables and commands are different, perhaps Somebody(TM) could write a 
syntax-propertize-function for sh-mode which would distinguish some of 
these constructs from others, and add the 'syntax-table' text property.

This is a lot more work, but I figured I should have mentioned it.

And for bash-ts-mode, the syntax-propertize-function could be easier to 
write, at least if the parser properly distinguishes these cases.