bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#46093: Shell-script mode formatting error eats half the page


From: Lars Ingebrigtsen
Subject: bug#46093: Shell-script mode formatting error eats half the page
Date: Wed, 27 Jan 2021 03:09:23 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

積丹尼 Dan Jacobson <jidanni@jidanni.org> writes:

> Here we observe lines severely shoved over due to Shell-script mode not
> recognizing the statement has terminated. emacs-version "27.1".
>
> $ cat x.sh
> set /home/$j/.adobe /home/$j/.macromedia && for i do if test -d $i; then rm 
> -vr $i; fi; done
>                                                 echo these lines are now 
> indented wrongly
>                                                 echo these lines are now 
> indented wrongly for the rest of the file.
>                                                 echo There is no recovery.

Here's a simpler reproducer:

for i do; if test -d $i; then rm -vr $i; fi; done
    echo these lines are now indented wrongly
    echo these lines are now indented wrongly for the rest of the file.
    echo There is no recovery.

This indents correctly, though:

for i; do if test -d $i; then rm -vr $i; fi; done
echo these lines are now indented wrongly
echo these lines are now indented wrongly for the rest of the file.
echo There is no recovery.

(I moved the semicolon to before the "do", not after.  Which is
apparently the correct syntax according to

https://www.gnu.org/software/bash/manual/bash.html#Compound-Commands

for

    The syntax of the for command is:

    for name [ [in [words …] ] ; ] do commands; done

So Emacs seems to do the correct thing here; closing.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





reply via email to

[Prev in Thread] Current Thread [Next in Thread]