CodingStyle

Dirk Hohndel dirk at hohndel.org
Wed Mar 5 09:48:46 PST 2014


On Wed, 2014-03-05 at 17:29 +0100, Cristian Ionescu-Idbohrn wrote:
> On Mon, 3 Mar 2014, Dirk Hohndel wrote:
> >
> > OK, I used my lunch break (the things I do for fun...) to tweak the tool
> > and fixed two odd cases that I noticed when studying profile.c.
> 
> And I used my sick leave to do the same :)
> See attached elisp script subsurface.el.
> The 'linux-tabs-only' style is (for now) restricted to .[ch] files.
> 
> > Would you test the emacs auto-generated indentation settings against
> > the latest?
> 
> Did that.  The result in not perfect, but there are a few more knobs
> for further adjustments.
> 
> It corrects a few indentation problems, makes some indentation
> glitches obvious and creates new ones ;)

I haven't gone through all of this (675 lines of patches), but I notice
a few things that stand out:

- Positioning of a trailing '\' 

Hard to get worked up about. The logic in clang-format seems a bit
inconsistent there - it's what I'm working with

- Positioning of the /* fallthrough */ comment in switch statements

I kinda like it where I had it (lined up with "case" so it stands out
more)

- indentation of follow up lines in multi line #define

I actually like neither of the version. In tree right now we have some
with four space indentation (WTF?) - but your version in some instances
indents things way too much... I'll need to play with that to find a
happy medium.

- alignment of multi line comments with /* and *

That's an improvement. I wonder why this is broken in tree right now

And then there is what your script does to code that is inside of
comments, where it completely removes indentation. Not cool.

> One thing I noticed is that dive.h needs possibly some more love.
> Things like:
> 
> 	#define MAX_CYLINDERS (8)
> 	#define MAX_WEIGHTSYSTEMS (6)
> 	#define W_IDX_PRIMARY 0
> 	#define W_IDX_SECONDARY 1

Yeah, that should be consistent.

> although not incorrect, create some coding style confusion.  And this:
> 
> 	#define TRIP_THRESHOLD 3600 * 24 * 3
> 
> may be a good idea to change to:
> 
> 	#define TRIP_THRESHOLD (3600 * 24 * 3)

True

> Well, why not let people take a look and improve the elisp script.

> > And add them to CodingStyle if they seem to work?
> 
> Shouldn't I wait a while to give people time to play with it?
> 
> If I were to add subsurface.el to the repository I would put it in the
> scripts directory.


BTW, just to make sure there's no misunderstanding. Are you suggesting
switching to the .el script as the 'reference implementation of the
coding style'?


/D





More information about the subsurface mailing list