* cc-mode indent, exception for long lines
@ 2002-10-15 21:09 Matt Armstrong
2002-10-18 16:47 ` Benjamin Riefenstahl
2002-10-18 17:33 ` maierh
0 siblings, 2 replies; 3+ messages in thread
From: Matt Armstrong @ 2002-10-15 21:09 UTC (permalink / raw)
I like to keep my C code lines to 80 columns, for easier
editing/printing.
But, sometimes I have a long string constant or identifier, and
cc-mode's indentation isn't optimal. E.g.
if (ReallyLongFunctionName(AnotherReallyLongFunctionName("a really long string constant")
{
}
I haven't been able to get cc-mode to help me much here. It'd be great
if it had a way to sense that the result of an indentation will go
beyond N columns and go into an alternate mode that results in something
like this:
if (ReallyLongFunctionName(
AnotherReallyLongFunctionName(
"a really long string constant")
{
}
(the above indentation is the "vim" editor's default indentation -- the
first line after a paren is indented 8 spaces, all subsequent lines 8+4
spaces).
Any tips?
--
matt
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: cc-mode indent, exception for long lines
2002-10-15 21:09 cc-mode indent, exception for long lines Matt Armstrong
@ 2002-10-18 16:47 ` Benjamin Riefenstahl
2002-10-18 17:33 ` maierh
1 sibling, 0 replies; 3+ messages in thread
From: Benjamin Riefenstahl @ 2002-10-18 16:47 UTC (permalink / raw)
Hi Matt,
Matt Armstrong <matt@lickey.com> writes:
> I like to keep my C code lines to 80 columns, for easier
> editing/printing.
Lots of people agree with that rule ;-).
> But, sometimes I have a long string constant or identifier, and
> cc-mode's indentation isn't optimal. E.g.
>
> if (ReallyLongFunctionName(AnotherReallyLongFunctionName("a really long string constant")
> {
> }
? There is no problem with indentation here, is there? What you seem
to want is automatic insertion of line ends for wrapping. cc-mode
doesn't do that, I admit. I'm not sure I would want it either.
> if (ReallyLongFunctionName(
> AnotherReallyLongFunctionName(
> "a really long string constant")
> {
> }
With my settings and adding the missing parentheses to your code I get
if (ReallyLongFunctionName(
AnotherReallyLongFunctionName(
"a really long string constant")))
{
}
Which is pretty near to what you seem to want. I did have to add line
breaks manually, of course.
so long, benny
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: cc-mode indent, exception for long lines
2002-10-15 21:09 cc-mode indent, exception for long lines Matt Armstrong
2002-10-18 16:47 ` Benjamin Riefenstahl
@ 2002-10-18 17:33 ` maierh
1 sibling, 0 replies; 3+ messages in thread
From: maierh @ 2002-10-18 17:33 UTC (permalink / raw)
Matt Armstrong <matt@lickey.com> writes:
> I like to keep my C code lines to 80 columns, for easier
> editing/printing.
>
> But, sometimes I have a long string constant or identifier, and
> cc-mode's indentation isn't optimal. E.g.
>
> if (ReallyLongFunctionName(AnotherReallyLongFunctionName("a really long string constant")
> {
> }
>
> I haven't been able to get cc-mode to help me much here. It'd be great
> if it had a way to sense that the result of an indentation will go
> beyond N columns and go into an alternate mode that results in something
> like this:
>
> if (ReallyLongFunctionName(
> AnotherReallyLongFunctionName(
> "a really long string constant")
> {
> }
I am using this. Looks closely to your example:
;; (c-set-offset 'arglist-intro '+)
if (ReallyLongFunctionName(
AnotherReallyLongFunctionName(
"a really long string constant")
{
}
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2002-10-18 17:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-10-15 21:09 cc-mode indent, exception for long lines Matt Armstrong
2002-10-18 16:47 ` Benjamin Riefenstahl
2002-10-18 17:33 ` maierh
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).