GNU bug report logs - #72745
`bash-mode` doesn't recognize comments inside command substitution

Previous Next

Package: emacs;

Reported by: "shynur ." <one.last.kiss <at> outlook.com>

Date: Wed, 21 Aug 2024 13:09:02 UTC

Severity: normal

To reply to this bug, email your comments to 72745 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#72745; Package emacs. (Wed, 21 Aug 2024 13:09:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to "shynur ." <one.last.kiss <at> outlook.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 21 Aug 2024 13:09:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "shynur ." <one.last.kiss <at> outlook.com>
To: "bug-gnu-emacs <at> gnu.org" <bug-gnu-emacs <at> gnu.org>
Subject: `bash-mode` doesn't recognize comments inside command substitution
Date: Wed, 21 Aug 2024 13:02:24 +0000
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.



Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#72745; Package emacs. (Sat, 24 Aug 2024 09:21:01 GMT) Full text and rfc822 format available.

Message #8 received at 72745 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: "shynur ." <one.last.kiss <at> outlook.com>,
 Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 72745 <at> debbugs.gnu.org
Subject: Re: bug#72745: `bash-mode` doesn't recognize comments inside command
 substitution
Date: Sat, 24 Aug 2024 12:19:37 +0300
> From: "shynur ." <one.last.kiss <at> outlook.com>
> Date: Wed, 21 Aug 2024 13:02:24 +0000
> 
> 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?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#72745; Package emacs. (Sat, 24 Aug 2024 15:14:02 GMT) Full text and rfc822 format available.

Message #11 received at 72745 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: "shynur ." <one.last.kiss <at> outlook.com>, 72745 <at> debbugs.gnu.org
Subject: Re: bug#72745: `bash-mode` doesn't recognize comments inside
 command substitution
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





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#72745; Package emacs. (Sat, 24 Aug 2024 15:32:02 GMT) Full text and rfc822 format available.

Message #14 received at 72745 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: one.last.kiss <at> outlook.com, 72745 <at> debbugs.gnu.org
Subject: Re: bug#72745: `bash-mode` doesn't recognize comments inside
 command substitution
Date: Sat, 24 Aug 2024 18:28:21 +0300
> From: Stefan Monnier <monnier <at> iro.umontreal.ca>
> Cc: "shynur ." <one.last.kiss <at> outlook.com>,  72745 <at> debbugs.gnu.org
> 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).

FWIW, I tried bash-ts-mode, and it doesn't show the comment face
there, either.




This bug report was last modified 294 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.