Re: [RFC] Balsa coding style



Hi Peter:

Am 13.03.16 00:22 schrieb(en) Peter Bloomfield:
[me home balsa]$ find . -name '*.[ch]' -exec  indent -kr -i4 -l132 -lc132 -ts4 -psl '{}' ';'
indent: ./libbalsa/libbalsa-gpgme-cb.h:55: Error:Stmt nesting error.
indent: ./libbalsa/imap/imap-handle.c:1843: Warning:old style assignment ambiguity in "=-".  Assuming "= -"
indent: ./src/main-window.c:5112: Error:Unexpected end of file

I must admit that I didn't try to run the command recursively, just on a few files I touched :-/

The first of these seems to be another of the MAKE_EMACS_HAPPY hacks.

If we consider this as an now obsolete hack, it should be removed *everywhere* in the code IMHO...

The second looks like a correct assumption!

Yes.  Looks confusing indeed in the original code!

The third I believe to be caused by some conditionally compiled code that is straight line code under one 
condition and an if/else clause in another, with some cleverly placed curly brackets to make it build in 
either case. We should probably simplify the conditioning, at the cost of duplicating those lines.

IMO this is a good idea.

Otherwise, I like the look of the cleaned up code! You're right, it would ease maintenance considerably. I 
suppose vim will wrap incorrectly (unless there's a way to set the wrap length specifically for C files), but 
I can always pipe through indent.

I found this hint which might help: 
<https://stackoverflow.com/questions/234564/tab-key-4-spaces-and-auto-indent-after-curly-braces-in-vim/21323445#21323445>.
  IIRC, vim knows something like 'set textwidth=132'.  You might want to add a sample .vimrc file with proper 
settings to the project.

I must admit that I never tried folding code in vim, though.  I *really* like the little helpers in Eclipse 
(although setting up everything properly is not that easy).

Cheers
Albrecht.

Attachment: pgpAsGxBuP4xC.pgp
Description: PGP signature



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