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

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

Re: indent-tab-mode


From: Gary Wessle
Subject: Re: indent-tab-mode
Date: 02 Oct 2006 05:25:09 +1000
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4

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



reply via email to

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