GNU bug report logs - #17620
sh-mode indentation of continued do loop lists

Previous Next

Package: emacs;

Reported by: Glenn Morris <rgm <at> gnu.org>

Date: Wed, 28 May 2014 21:27:01 UTC

Severity: minor

Found in version 24.3.91

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 17620 <at> debbugs.gnu.org
Subject: bug#17620: sh-mode indentation of continued do loop lists
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




This bug report was last modified 9 years and 240 days ago.

Previous Next


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