GNU bug report logs - #15613
Wrong indentation in Shell-script[sh] mode?

Previous Next

Package: emacs;

Reported by: Angelo Graziosi <angelo.graziosi <at> alice.it>

Date: Mon, 14 Oct 2013 20:54:01 UTC

Severity: normal

Fixed in version 24.4

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #14 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Angelo Graziosi <angelo.graziosi <at> alice.it>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: bug-emacs <bug-gnu-emacs <at> gnu.org>
Subject: Re: bug#15613: Wrong indentation in Shell-script[sh] mode?
Date: Wed, 16 Oct 2013 00:23:15 +0200
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.