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

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

Re: indentation - always a pita


From: Harry Putnam
Subject: Re: indentation - always a pita
Date: Wed, 25 Jun 2003 06:30:59 -0700
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (gnu/linux)

kai.grossjohann@gmx.net (Kai Großjohann) writes:
> I just had a quick look, but maybe you could check
> 
> (setq sh-indentation 2)
> (setq-default indent-tabs-mode nil)
> 
> (The variable indent-tabs-mode is buffer-local by default.  With
> setq-default, most modes will avoid tabs for indentation.  If you
> only want to tweak this for shell script mode, then you can do it
> with a mode hook.)

I just tried this, but not sure its a fair test:

1) Put the two lines you suggest as sole entries in lisp.el then start
   a fresh emacs. (emacs -q -no-site-file -bg midnightblue -l ./lisp.el -l 
./vi-list.el)
(vi-list.el is some plaguerized code that allows one to display a
   buffer as if vi's `list' command had been run on it. (showing
   ^I = tab $= newline)

   Set background different than usual so I could keep track of which
   emacs has the new code.

2) Started a second emacs (emacs -q -no-site-file -l ./vi-list.el)
   (without the new code)

Ran C-x h then C-M \ on both  Then saved the results as:
shellt1.sh (new code)
shellt2.sh (no new code) 

Both files are attached.
invoking vi-list shows the tabs are gone, but strangely the code is
formatted almost the same.  The deepest indentation being only 2 spcs
different. I would have expected to gain quite a lot more.

The source file looks like:
Cat shell-script.sh
if [ ];then
if [ ];then
case $opt in
t) cmd
lf  [ ];then 
cmd
fi
;;
h) cmd
if [ ];then
case $otheropt in
a) cmd
if [ ];then
cmd
fi
;;
b) cmd
::
esac
fi
 esac
if [];then
cmd
ii
fi
fi

Attachment: shellt1.sh
Description: with new code

Attachment: shellt2.sh
Description: without new code


reply via email to

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