Subject: bug#72745: `bash-mode` doesn't recognize comments inside command substitution

From: Stefan Monnier <[email-masked]>
Date: Sat, 24 Aug 2024 11:12:06 -0400

>> Reproduce:
>>   1. echo -e 'echo $(echo 42  # print 42)\n)' > /tmp/a.bash
>>      Content of `/tmp/a.bash`:
>>           echo $(echo 42  # print 42)                                                                                         
>>           )
>>   2. emacs -Q, version 29.4
>>   3. eval: (set-face-italic font-lock-comment-face t)
>>   4. Open file `/tmp/a.bash`.
>> 
>> Only the first `)` is italic; "# print 42" is not.
>
> I'm not sure this is not the right behavior.
> Does anyone else have an opinion here?

Too many "not"s in one sentence, and too many nested "echo"s in
the other.

But when I try to run

    #!/bin/bash
    echo $(echo 42  # print 42)
    )
    echo there

it returns

    42
    there

as expected.  IOW, I agree with the title of this bug report (and in my
test, Emacs doesn't highlighted any part of that script with the comment face).

        Stefan