[EMAIL PROTECTED] writes:
>Also, I really like Eclipse, is there a way to provide to eclipse some sort
>of style config file that specifies all those rules? I have to restrain
>myself from accidentally reformatting tubine files in Eclipse.
>Eric Pugh
Some preliminary emacs style:
1)
my "old" style which unfortunately does only 4 spaces for
public void foo()
throws Exception
^^^^
because the c-lineup-java-throws uses a "c-basic-offset" here.
(defconst old-apache-java-style
'((c-basic-offset . 4)
(c-comment-only-line-offset 0 . 0)
(indent-tabs-mode . nil)
(c-offsets-alist
(access-label . 0)
(arglist-close . c-lineup-arglist)
(arglist-cont . 0)
(arglist-cont-nonempty . +)
(arglist-intro . +)
(func-decl-cont . c-lineup-java-throws)
(inher-intro . ++)
(inher-cont . c-lineup-java-inher)
(inline-open . 0)
(knr-argdecl-intro . +)
(label . +)
(statement-block-intro . +)
(statement-case-open . +)
(statement-cont . ++)
(substatement-open 0 nil)
(topmost-intro-cont . +)))
"old-apache-java"
)
2)
A newer style which is better but I feel a little uncomfortable
because it uses 8 as basic offset and tricks all other offsets in
being "halve".
(defconst apache-java-style
'((c-basic-offset . 8)
(c-comment-only-line-offset 0 . 0)
(indent-tabs-mode . nil)
(c-offsets-alist
(arglist-close . c-lineup-arglist)
(arglist-cont-nonempty . +)
(arglist-intro . +)
(brace-list-intro . *)
(c . c-lineup-C-comments)
(comment-intro . c-lineup-comment)
(cpp-macro-cont . c-lineup-dont-change)
(defun-block-intro . *)
(func-decl-cont . c-lineup-java-throws)
(inclass . *)
(inexpr-class . *)
(inextern-lang . *)
(inher-intro . +)
(inher-cont . c-lineup-java-inher)
(inher-intro . +)
(inlambda . c-lineup-inexpr-block)
(inline-open . 0)
(innamespace . *)
(knr-argdecl-intro . *)
(topmost-intro-cont . +)
(label . 2)
(lambda-intro-cont . *)
(member-init-cont . c-lineup-multi-inher)
(member-init-intro . *)
(objc-method-args-cont . c-lineup-ObjC-method-args)
(objc-method-call-cont . c-lineup-ObjC-method-call)
(statement-block-intro . *)
(statement-case-intro . *)
(statement-case-open . *)
(statement-cont . +)
(stream-op . c-lineup-streamop)
(string . c-lineup-dont-change)
(substatement . *)
(substatement-open 0 nil)
(template-args-cont . (c-lineup-template-args *))
))
"apache-java"
)
They do differ in indenting "hanging arguments" and the throws as
described above. I personally will go for future stuff with the 2nd
style.
Any improvements welcome and I'd be happy if anyone puts these on the
main turbine site (where is a little outdated example in the "Coding
Conventions" page.
And no, I'm nowhere near being some sort of lisp hacker. This is almost
pure C-x C-o and testing. ;-) Thanks Daniel for this trick.
Regards
Henning
--
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen INTERMETA GmbH
[EMAIL PROTECTED] +49 9131 50 654 0 http://www.intermeta.de/
Java, perl, Solaris, Linux, xSP Consulting, Web Services
freelance consultant -- Jakarta Turbine Development -- hero for hire
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]