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
(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))))
--- /tmp/bar.c	2014-03-03 15:48:16.386226387 +0100
+++ /tmp/bar.linux-tabs-only.c	2014-03-03 15:52:14.209804561 +0100
@@ -1414,17 +1414,17 @@
 		 * END just uses N2 */
 		entry->mod = (prefs.mod_ppO2 / fo2 * 1000 - 1) * 10000;
 		entry->ead = (entry->depth + 10000) *
-				 (entry->po2 + (amb_pressure - entry->po2) * (1 - ratio)) / amb_pressure -
-			     10000;
+			(entry->po2 + (amb_pressure - entry->po2) * (1 - ratio)) / amb_pressure -
+			10000;
 		entry->end = (entry->depth + 10000) *
-				 (amb_pressure - entry->po2) * (1 - ratio) / amb_pressure / N2_IN_AIR * 1000 -
-			     10000;
+			(amb_pressure - entry->po2) * (1 - ratio) / amb_pressure / N2_IN_AIR * 1000 -
+			10000;
 		entry->eadd = (entry->depth + 10000) *
-				  (entry->po2 / amb_pressure * O2_DENSITY + entry->pn2 / amb_pressure *
-										N2_DENSITY +
-				   entry->phe / amb_pressure * HE_DENSITY) /
-				  (O2_IN_AIR * O2_DENSITY + N2_IN_AIR * N2_DENSITY) * 1000 -
-			      10000;
+			(entry->po2 / amb_pressure * O2_DENSITY + entry->pn2 / amb_pressure *
+			 N2_DENSITY +
+			 entry->phe / amb_pressure * HE_DENSITY) /
+			(O2_IN_AIR * O2_DENSITY + N2_IN_AIR * N2_DENSITY) * 1000 -
+			10000;
 		if (entry->mod < 0)
 			entry->mod = 0;
 		if (entry->ead < 0)
@@ -1479,17 +1479,17 @@
 		 * END just uses N2 */
 		entry->mod = (prefs.mod_ppO2 / fo2 * 1000 - 1) * 10000;
 		entry->ead = (entry->depth + 10000) *
-				 (entry->po2 + (amb_pressure - entry->po2) * (1 - ratio)) / amb_pressure -
-			     10000;
+			(entry->po2 + (amb_pressure - entry->po2) * (1 - ratio)) / amb_pressure -
+			10000;
 		entry->end = (entry->depth + 10000) *
-				 (amb_pressure - entry->po2) * (1 - ratio) / amb_pressure / N2_IN_AIR * 1000 -
-			     10000;
+			(amb_pressure - entry->po2) * (1 - ratio) / amb_pressure / N2_IN_AIR * 1000 -
+			10000;
 		entry->eadd = (entry->depth + 10000) *
-				  (entry->po2 / amb_pressure * O2_DENSITY + entry->pn2 / amb_pressure *
-										N2_DENSITY +
-				   entry->phe / amb_pressure * HE_DENSITY) /
-				  (O2_IN_AIR * O2_DENSITY + N2_IN_AIR * N2_DENSITY) * 1000 -
-			      10000;
+			(entry->po2 / amb_pressure * O2_DENSITY + entry->pn2 / amb_pressure *
+			 N2_DENSITY +
+			 entry->phe / amb_pressure * HE_DENSITY) /
+			(O2_IN_AIR * O2_DENSITY + N2_IN_AIR * N2_DENSITY) * 1000 -
+			10000;
 		if (entry->mod < 0)
 			entry->mod = 0;
 		if (entry->ead < 0)
_______________________________________________
subsurface mailing list
[email protected]
http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to