[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
sh-script indentation setting consistency improvements
From: |
Michael Wardle |
Subject: |
sh-script indentation setting consistency improvements |
Date: |
Thu, 12 May 2005 20:55:12 +1000 (EST) |
This bug report will be sent to the Free Software Foundation,
not to your local site managers!
Please write in English, because the Emacs maintainers do not have
translators to read other languages for them.
Your bug report will be posted to the bug-gnu-emacs@gnu.org mailing list,
and to the gnu.emacs.bug news group.
In GNU Emacs 21.4.1 (i386-pc-linux-gnu)
of 2005-03-18 on trouble, modified by Debian
configured using `configure '--build=i386-linux' '--host=i386-linux'
'--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib'
'--localstatedir=/var/lib' '--infodir=/usr/share/info'
'--mandir=/usr/share/man' '--with-pop=yes' '--with-x=no' 'CFLAGS=-DDEBIAN -g
-O2' 'build_alias=i386-linux' 'host_alias=i386-linux''
Important settings:
value of $LC_ALL: nil
value of $LC_COLLATE: nil
value of $LC_CTYPE: nil
value of $LC_MESSAGES: nil
value of $LC_MONETARY: nil
value of $LC_NUMERIC: nil
value of $LC_TIME: nil
value of $LANG: en_AU.utf8
locale-coding-system: utf-8
default-enable-multibyte-characters: t
Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:
Following on from my previous message of May 8, I have a few more
comments regarding the default settings for sh-mode indentation.
The current default indentation settings are:
sh-indent-for-do: +
sh-indent-after-do: *
sh-indent-after-loop-construct: +
sh-indent-after-if: +
sh-indent-for-then: +
Probably the most common shell style -- when indented using these
settings -- would look like this:
if [ -n "$verbose" ]; then
for arg; do
echo $arg
done
fi
An alternate form that I prefer -- where the if..then..fi and
while..do..done are split over two lines, thus avoiding the
semi-colon -- looks like this using the same settings:
if [ -n "$verbose" ]
then
for arg
do
echo $arg
done
fi
I think the form of indentation generated by Emacs sh-script for
the second example is, while elegant, needlessly different from
the first and does not reflect common usage.
I believe the second example should be indented this way:
if [ -n "$verbose" ]
then
for arg
do
echo $arg
done
fi
This indentation style maintains the loop bodies in the same column
irrespective of whether semi-colons are used. It is also the one
that appears in the second edition of "Learning the Korn Shell" by
Bill Rosenblatt, the same style that sh-mode claims to support.
Refer:
if..then: page 136
for..do: page 154
The settings to achieve this indentation style are:
sh-indent-after-if: + (unchanged)
sh-indent-for-then: 0 (previously +)
sh-indent-for-do: 0 (previously +)
sh-indent-after-do: + (previously *)
Having investigated this, I am now aware of which settings I can
use in my .emacs file, but I would like these to become the
defaults so that all users can benefit from them.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- sh-script indentation setting consistency improvements,
Michael Wardle <=