From: Gary Wessle <phddas@yahoo.com>
Subject: Re: indent-tab-mode
Date: 02 Oct 2006 05:25:09 +1000 [thread overview]
Message-ID: <m3ac4fon3e.fsf@localhost.localdomain> (raw)
In-Reply-To: 87psddujj8.fsf@baldur.nicundtas.de
Tassilo Horn <heimdall@uni-koblenz.de> writes:
> Gary Wessle <phddas@yahoo.com> writes:
>
> Hi Gary,
>
> > my indent-tab-mode is on but when I am writing in sh mode
> >
> > #!/bin/sh
> > if [ ... ]
> > then
> >
> > the "then" is not indented automatically. how can I fix this?
>
> `indent-tab-mode' has nothing to do with how the indention of certain
> programming language constructs looks like. If it's non-nil, indentation
> uses tabs, if it's nil it uses spaces.
>
> ,----[ C-h v indent-tabs-mode RET ]
> | indent-tabs-mode is a variable defined in `C source code'.
> |
> | [...]
> |
> | Documentation:
> | *Indentation can insert tabs if this is non-nil.
> | Setting this variable automatically makes it local to the current buffer.
> `----
>
> I think it's quite common not to indent `then':
>
> ,----
> | if [...]
> | then
> | do-this
> | do-that
> | done
> `----
>
> Another common style is:
>
> ,----
> | if [...]; then
> | do-this
> | do-that
> | done
> `----
>
> Bye,
> Tassilo
then how can I indent-while-typing this code
#!/bin/sh
#
# if not vehicle name is given
# i.e. -z $1 is defined and it is NULL
#
# if no command line arg
if [ -z $1 ]
then
rental="*** Unknown vehicle ***"
elif [ -n $1 ]
then
# otherwise make first arg as rental
rental=$1
fi
case $rental in
"car") echo "For $rental Rs.20 per k/m";;
"van") echo "For $rental Rs.10 per k/m";;
"jeep") ehco "For $rental Rs.5 per k/m";;
"bicycle") echo "For $rental 20 paisa per k/m";;
*) echo "Sorry, I can not get a $rental for you";;
esac
next prev parent reply other threads:[~2006-10-01 19:25 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-30 21:03 indent-tab-mode Gary Wessle
2006-09-30 21:33 ` indent-tab-mode Tassilo Horn
2006-10-01 19:25 ` Gary Wessle [this message]
2006-10-01 19:55 ` indent-tab-mode Peter Dyballa
2006-10-01 20:25 ` indent-tab-mode s. keeling
2006-10-02 0:37 ` indent-tab-mode Gary Wessle
2006-10-11 11:57 ` indent-tab-mode Sam Peterson
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m3ac4fon3e.fsf@localhost.localdomain \
--to=phddas@yahoo.com \
/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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).