Formatting scripts in CTDB source code (was Re: [PATCHES] Various CTDB bug fixes and improvements)
obnox at samba.org
Wed Jan 13 10:03:44 UTC 2016
On 2016-01-13 at 14:57 +1100, Martin Schwenke wrote:
> On Tue, 12 Jan 2016 19:17:34 +0100, Michael Adam <obnox at samba.org>
> > - It would be *SOOO* great if we could stop using
> > that 8-char tab + 4 chars as half tab indentation!!! :-)
> Sold! :-)
> I think this is historical. Most people hacking the scripts (including
> me) have been Emacs users and that is the default Emacs indentation for
> shell scripts.
Sheer insanity... :-)
> As long as nobody complains I'll switch to tabs
That's one possibility, and I also like to use tabs, but
given the potentiallybig levels of indentation, we might
also choose to use indentation of e.g. 4 spaces instead of
tabs (like with python scripts). That would effectively just
convert the current formatting from using one tab for two
indentation levels using 8 spaces for the same, hence the
result would look more similar.
> and update code as it gets edited.
Sure, that's the approach to take.
(I.e. instad of doing sweeping changes.)
I have just been thinking since a while, that we should also
for for the shell scripts have some formatting
rules or guidelines.
> As per:
> I'll make case statement labels line up with the "case" keyword to
> avoid crazy amounts of indentation. The author of that page seems to
> suggest that this makes the indentation compatible with VIM.
I don't know. The standard 4 space also looks ok to me.
But if we go with 8 char tabs, I agree that the above
approach looks better.
> For the record, I'm using the following in my ~/.emacs:
> (setq-default sh-basic-offset 8
> sh-indentation 8
> sh-indent-for-case-label 0
> sh-indent-for-case-alt '+)
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 198 bytes
Desc: not available
More information about the samba-technical