0

Since upgrade to Emacs 28.1, I have noted an annoy change in shell-script mode auto-formatting.

I would like to recover the old behavior

Before, if I entered

if [ "$x" = "" ];then
    export x=$y
fi

and then enter new line, the new line would align with the fi

if [ "$x" = "" ];then
    export x=$y
fi
cp fred ethel

Now it I do the same thing I get the new line indented

if [ "$x" = "" ];then
    export x=$y
fi
    cp fred ethel

The matching code also does not recognize that the fi is connected to the then statement.

This is not the case if I break the if into two lines:

if [ "$x" = "" ]
then
    export x=$y
fi
cp fred ethel

Any suggestions?

1
  • If you see the change when you start Emacs with emacs -Q then consider filing a bug report: M-x report-emacs-bug. It might represent an intentional change, but it might not. A bug report will be responded to with the answer.
    – Drew
    Commented Jan 28, 2023 at 1:59

1 Answer 1

1

I can reproduce this and it seems like a bug (please do report it), but you can work around it by putting a space after the semicolon (which I think almost everyone does, which would explain why this wasn't spotted by anyone).

1
  • 1
    Yes, that will fix the issue. I will report a bug, as this is a change in behavior.
    – SzS
    Commented Jan 30, 2023 at 22:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.