CodingStyle

Cristian Ionescu-Idbohrn cristian.ionescu-idbohrn at axis.com
Mon Mar 3 07:17:12 PST 2014


On Mon, 3 Mar 2014, Dirk Hohndel wrote:
> On Mon, 2014-03-03 at 15:41 +0100, Cristian Ionescu-Idbohrn wrote:
> > Emacs has the ability to learn coding styles.
>
> Cool, I had never used that before.
>
> > Dirk,
> >
> > Could you please point out a few files that could be used as
> > templates?
>
> At this point, the C/C++/h files have been reformatted using my clang
> tool. Some things are not as I would love them to be (e.g. what was done
> to the enums), but as I said when I announced that commit - this is
> better than what we had before because it can easily be reproduced.

So, you mean any file could be a template?  Alright.  I took
profile.c, replaced the profile.h include with its contents, generated
the elisp-script-fragment (attachment #1) and used that to reindent
the file.  The diff result is shown in attachment #2.


Cheers,

-- 
Cristian
-------------- next part --------------
(c-add-style "linux-tabs-only"
	     '("linux"
	       (c-basic-offset . 8)	; Guessed value
	       (c-offsets-alist
		(block-close . 0)	; Guessed value
		(brace-list-close . 0)	; Guessed value
		(brace-list-entry . 0)	; Guessed value
		(brace-list-intro . +)	; Guessed value
		(class-close . 0)	; Guessed value
		(cpp-define-intro . +)	; Guessed value
		(defun-block-intro . +)	; Guessed value
		(defun-close . 0)	; Guessed value
		(defun-open . 0)	; Guessed value
		(else-clause . 0)	; Guessed value
		(extern-lang-close . 0)	; Guessed value
		(inclass . +)		; Guessed value
		(inextern-lang . 0)	; Guessed value
		(statement . 0)		    ; Guessed value
		(statement-block-intro . +) ; Guessed value
		(substatement . +)	; Guessed value
		(topmost-intro . 0)	; Guessed value
		(access-label . -)
		(annotation-top-cont . 0)
		(annotation-var-cont . +)
		(arglist-close . c-lineup-close-paren)
		(arglist-cont c-lineup-gcc-asm-reg 0)
		(arglist-cont-nonempty . c-lineup-arglist)
		(arglist-intro . +)
		(block-open . 0)
		(brace-entry-open . 0)
		(brace-list-open . 0)
		(c . c-lineup-C-comments)
		(case-label . 0)
		(catch-clause . 0)
		(class-open . 0)
		(comment-intro . c-lineup-comment)
		(composition-close . 0)
		(composition-open . 0)
		(cpp-macro . -1000)
		(cpp-macro-cont . +)
		(do-while-closure . 0)
		(extern-lang-open . 0)
		(friend . 0)
		(func-decl-cont . +)
		(incomposition . +)
		(inexpr-class . +)
		(inexpr-statement . +)
		(inher-cont . c-lineup-multi-inher)
		(inher-intro . +)
		(inlambda . c-lineup-inexpr-block)
		(inline-close . 0)
		(inline-open . +)
		(inmodule . +)
		(innamespace . +)
		(knr-argdecl . 0)
		(knr-argdecl-intro . 0)
		(label . 0)
		(lambda-intro-cont . +)
		(member-init-cont . c-lineup-multi-inher)
		(member-init-intro . +)
		(module-close . 0)
		(module-open . 0)
		(namespace-close . 0)
		(namespace-open . 0)
		(objc-method-args-cont . c-lineup-ObjC-method-args)
		(objc-method-call-cont c-lineup-ObjC-method-call-colons c-lineup-ObjC-method-call +)
		(objc-method-intro .
				   [0])
		(statement-case-intro . +)
		(statement-case-open . 0)
		(statement-cont . +)
		(stream-op . c-lineup-streamop)
		(string . -1000)
		(substatement-label . 0)
		(substatement-open . 0)
		(template-args-cont c-lineup-template-args +)
		(topmost-intro-cont . c-lineup-topmost-intro-cont))))
-------------- next part --------------
A non-text attachment was scrubbed...
Name: profile.c.h.patch
Type: text/x-diff
Size: 2422 bytes
Desc: 
URL: <http://lists.hohndel.org/pipermail/subsurface/attachments/20140303/8169362e/attachment.patch>


More information about the subsurface mailing list