From: michael@mail.endbracket.net (Michael Wardle)
Subject: sh-script indentation setting consistency improvements
Date: Thu, 12 May 2005 20:55:12 +1000 (EST) [thread overview]
Message-ID: <20050512105512.6209836A1A@mail.endbracket.net> (raw)
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.
reply other threads:[~2005-05-12 10:55 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050512105512.6209836A1A@mail.endbracket.net \
--to=michael@mail.endbracket.net \
--cc=michael@endbracket.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.