----- Original Message -----
From: "Sergei Gnezdov" <[EMAIL PROTECTED]>
To: "'Paul Kinnucan'" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Wednesday, July 11, 2001 4:13 PM
Subject: RE: Java code conventions from Sun


> > What this means is the Emacs adheres to the Sun guidelines BY
> > DEFAULT. So
> > what your complaint?
>
> I have to warn that I executed the following command:
>
> M-x auto-fill-mode
>
> That may not be a correct way to go.
>

No it is not. Auto fill is for paragraphs of text. It is not syntax aware.
You must break lines of code manually as I said.

> The maximum size of the string is 72 characters (in case if I want to
print
> code with line numbers).
>
> >From Sun document:
> Wrapping Lines
> When an expression will not fit on a single line, break it according to
> these general principles:
> * Break after a comma.
> * Break before an operator.
> * Prefer higher-level breaks to lower-level breaks.
> * Align the new line with the beginning of the expression at the same
level
> on the previous
> line.
> * If the above rules lead to confusing code or to code that's squished up
> against the right
> margin, just indent 8 spaces instead.
>

[snip]

>
> The biggest complaint I have is that emacs will always create a code like
> this:
>
>       methodName(new Object(
>                             "value",
>                             "value"));
>

That's exactly what the Java guideline says it should do.

> while I need it to be
>      methodName(new Object(
>              "value",
>              "value"));
>
> You can also find that I prefer to use 8 spaces, because most of the
> identifiers are very long, thus nested indentation does not work well in
the
> 72 characters rantge (80 does not help a lot).

If I need to follow the last rule, I just indent the code manually.

You may be able to customize the Emacs indentation engine (cc-mode) to
indent continued lines 8 spaces instead of two the same syntactic level..
See the cc-mode doc.

If not,  ask the cc-mode maintainers to provide the capability.

- Paul

Reply via email to