Subject: Re: bug#2910: 23.0.60; Shell-script coloring bug

From: Mauro Aranda <[email-masked]>
Date: Fri, 13 Oct 2023 09:07:50 -0300

Martin Vath <[email-masked]> writes:

 > 1. M-x shell-script-mode
 > 2. Type: "
 > for i do echo 1; done
 > for i; do echo 1; done
 > "
 >
 > Despite both lines are correct full loops according to POSIX
 > and in fact understood by all current shells (see below),
 > this does not correspond to the indentation of emacs and
 > coloring of "do" in the first line.

This Bug Report (and the other ones merged with it) have two parts:
- No highlight for "do" in:
for i do echo 1; done

This works if using bash-ts-mode, which claims in its docstring it can
support Bash or sh.

I don't know what's the decision (if there is one) about situations like
these.  If the bugs in lang-mode are fixed by lang-ts-mode, will these
bug reports be treated as: wontfix? fixed? open in case someone wants to
spend time in lang-mode?

- Wrong indentation for lines after:
for i do echo 1; done

I took a look at this, and ISTM that giving "do" a special treatment
like sh-smie--sh-keyword-p gives to "in" might fix this, perhaps by
reusing sh-smie--sh-keyword-in-p.

I know very little about SMIE, so I'm CCing Stefan M.