[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: auto-fill mode in java-mode

From: Adam Hardy
Subject: Re: auto-fill mode in java-mode
Date: Mon, 13 Oct 2003 23:58:08 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20030925

On 10/13/2003 11:10 AM Alan Mackenzie wrote:
I'm trying to get my java-mode to wrap lines at 75 cols and I've not
got it working.

What do you mean by "lines"?  In the CC Modes, only comments get
auto-filled by default.  Are your comment lines getting auto-filled?  Do
you also want code lines to get auto-filled?

Yes they are and yes I do :)

If you want lines of code to get filled too, set the user option
c-ignore-auto-fill.  For example, in your mode hook add something like

(setq c-ignore-auto-fill '(cpp))

which will fill everything but preprocessor lines (do such exist in
Java?). c-ignore-auto-fill is fully documented on the page "Text Filling
and Line Breaking" in the CC Mode info pages.

I'm not sure how useful the auto-filling is in lines other than comment

That is very useful, thanks. And after reading the docs you pointed me at, I installed filladapt-mode as well, which makes it even better.

Essentially I want to restrict the width so I can just cut & paste my code into emails without the email mangling it.

It does sometimes break the line in surprising places, but that's not an issue.

There is only one quibble that I have with the arrangement as I now have it, and the cc-mode help, which is great, is not telling me how or why it happens:

- when auto-fill breaks a line, it ignores my idea of what the indentation should be. I have to hit tab (or an electric key) for the indentation to sort itself out. I assume my settings are in need of some adjustment, but I don't know which of the following it is:

(c-set-offset 'topmost-intro-cont c-basic-offset)
(c-set-offset 'inline-open 0)
(c-set-offset 'inclass 4)
(c-set-offset 'substatement-open 0)
(c-set-offset 'block-open '-)
(c-set-offset 'objc-method-intro 'c-lineup-arglist-intro-after-paren)
(setq c-electric-pound-behavior '(alignleft))
(local-set-key [return] 'newline-and-indent)

Thanks again,

GNU Emacs 21.3.1 on Linux 2.4.20 RH9

reply via email to

[Prev in Thread] Current Thread [Next in Thread]