GNU bug report logs -
#15613
Wrong indentation in Shell-script[sh] mode?
Previous Next
Full log
Message #14 received at submit <at> debbugs.gnu.org (full text, mbox):
Il 15/10/2013 16.37, Stefan Monnier ha scritto:
>> In the current trunk the indentation for bash scripts looks as in this test
>> case:
>
>> $ cat test_indent.sh
>> #!/bin/bash
>
>> if [ "${foo_a}" != "${foo_b}" ]; then
>
>> if [ "${foo_c}" = "${foo_d}" ]; then
>> echo
>> echo "Hello..."
>> echo
>> exit 1
>> fi
>
>> fi
>
> This works correctly if you use (setq sh-use-smie t) which I recommend.
>
> It is currently not the default setting because it doesn't yet support
> all the indentation-config variables of the old indentation code, and
> doesn't support the "guess indentation settings" feature either. But in
> most other respects it should work "as well or better".
Why, by default, the last "fi" should be under the previous and not
under _its_ "if"? Should "indent" mean that the matching if-fi, {-},
begin-end, if-endif etc. start the same column?
Instead the test case shows that all statements after the first "if"
if [ "${foo_a}" != "${foo_b}" ]; then
are considered belonging to its block statements. All the next formatted
code is lost.
This should be called "regression"..
Ciao,
Angelo.
This bug report was last modified 11 years and 217 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.