Daniel Stenberg <[email protected]> writes:

> On Thu, 29 Oct 2009, Simon Josefsson wrote:
>
>> Anyone who knows how to get Emacs to indent code like what the
>> libssh2 uses? What IS the libssh2 coding style anyway?  It doesn't
>> seem to be BSD nor K&R and definitely not the GNU style.
>
> The style is kind of a compromise of what people expressed back when I
> complained about the previous code style. The libssh2-style.el is what
> I use.

Ah, I had missed that.  I changed HACKING to add a pointer in it.

>> Alternatively, what parameters to 'indent' can I use to fix
>> indentation of code I write?
>
> The indent options I used when I converted from the old style is mentioned in
> the commit log, but it says:
>
>     --braces-on-if-line \
>     --braces-after-struct-decl-line \
>     --space-after-cast \
>     --line-length 79 \
>     --comment-line-length 79 \
>     --cuddle-else \
>     --no-tabs \
>     --tab-size 8 \
>     --indent-level 4 \
>     --no-space-after-for \
>     --space-after-if \
>     --space-after-while \
>     --no-space-after-function-call-names \

I wonder if using some standard coding style might not be easier, but I
don't care strongly.

> Over time, I've decided to violate a few of the previous other rules
> too when I've edited the code, such as the one that used to say that
> we MUST use braces on all expressions, even one-liners such as:
>
>   if (moo) {
>       foobar();
>   }
>
> ... as I think it makes the code less readable than plainly:
>
>   if (moo)
>       foobar();

I think that is more readable too.

/Simon
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

Reply via email to