Alex Rivera | Logout

How to enforce maximum line length in Emacs?

Asked 2009-04-07T01:39:14.813
23

In Emacs, how can I enforce a maximum line length of, say, 80 characters? I want it to insert proper line breaks in my code, much like fill-paragraph for text, if possible, with the correct insertion of the second part of the line.

Here a little example:

LongNameType<PrettyLong, AlsoLong> doSomethingWithLongFunctionName(int a, int b);
foo();

If I actually do fill-paragraph it becomes:

LongNameType<PrettyLong, AlsoLong>
doSomethingWithLongFunctionName(int a, int b); foo();

whereas I'd prefer this:

LongNameType<PrettyLong, AlsoLong>
  doSomethingWithLongFunctionName(int a, int b);
foo();
Edit
Report

1 Answer

0

Try

'(c-max-one-liner-length 80)

'(fill-column 80)
'(c-ignore-auto-fill (quote (string cpp)))

Hope it helps.

answered 2009-05-15T12:43:45.513

Your Answer