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

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

bug#15613: Wrong indentation in Shell-script[sh] mode?


From: Angelo Graziosi
Subject: bug#15613: Wrong indentation in Shell-script[sh] mode?
Date: Wed, 16 Oct 2013 00:23:15 +0200
User-agent: Mozilla/5.0 (Windows NT 5.1; rv:24.0) Gecko/20100101 Thunderbird/24.0.1

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.






reply via email to

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