Subject: Re: bug#17620: sh-mode indentation of continued do loop lists

From: Stefan Monnier <[email-masked]>
Date: Wed, 28 May 2014 22:23:50 -0400

> In 24.3.91, the continued line gets way too much indentation:
> for foo in a \
>                b; do
>     echo $foo
> done

I think this requires a config variable:

- The indentation you show above is the one that makes sense to me,
  where the \ is just a way to write "a b" on multiple logical lines,
  like you can do in most free-form programming languages, in which case
  "b", being an argument to "a", should be indented a bit deeper than
  "a".  I.e. the indentation rule pretends the \ don't really exist.

- The indentation you ask for seems to be based on the idea that "\" is
  a way to split a single logical line into several physical lines,
  doing a kind of manual "word wrap".

IOW the first view would want

    for f in a; do      \
        for g in b; do  \
            echo toto;  \
        done;           \
    done

[ tho I see now that the current code fails here (probably because it
  doesn't understand that the "do"s are "hanging").  ]

whereas the second view would want

    for f in a; do      \
        for g in b; do  \
        echo toto;      \
        done;           \
        done

I don't see a way to reconcile those two views, hence the need for
a config variable to choose between those two schools.

        Stefan