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.

Actually, I have an upper level script for emacs that detects from which project I load files from, and then selectively applies the style that particular project uses but that .el file is what I select for libssh2.

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 \

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();

--

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

Reply via email to