* cc-mode: Reverting to the 'dumber' indentation of nested function calls, as seen in Emacs20
@ 2003-11-10 19:00 ERDI Gergo
2003-11-13 19:33 ` ERDI Gergo
0 siblings, 1 reply; 5+ messages in thread
From: ERDI Gergo @ 2003-11-10 19:00 UTC (permalink / raw)
Cc: cactus
[Please CC replies to cactus@cactus.rulez.org]
Hi,
I've looked around in the depths of cc-mode but couldn't find the solution
for this one. The short story is that I'd like to get back a default
behaviour of Emacs20 when breaking lines with nested function calls.
Suppose I have this line of code:
long_function_name (bar (baz (0)));
Suppose I have c-basic-offset set to 2. If I put the baz (0) in a new
line, here's what I get with emacs20 ('#' denotes 2's of spaces inserted
by c-basic-offset):
##long_function_name (bar (
####baz (0)));
However, with Emacs21, here's what I get (again, '#' denotes double-spaces
from c-basic-offset. '$' denotes spaces inserted by an unknown smart
offset-calculator that I wasn't able to hunt down)
##long_function_name (bar (
$$$$$$$$$$$$$$$$$$$$$$##baz (0)));
I've compared the c-offsets-alist of emacs20 and emacs21 but couldn't find
the offset-calculator function. If I had that, I guess I'd just substitute
it with a normal indentation offset (c-basic-offset number of spaces) and
I'd be all set.
So, who's inserting all those '$'s and how do I get rid of it?
Thanks,
Gergo
[Please CC replies to cactus@cactus.rulez.org]
--
.--= ULLA! =---------------------. `We are not here to give users what
\ http://cactus.rulez.org \ they want' -- RMS, at GUADEC 2001
`---= cactus@cactus.rulez.org =---'
Jesus has changed your life. Save changes? [Yes] [No] [Cancel]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: cc-mode: Reverting to the 'dumber' indentation of nested function calls, as seen in Emacs20
[not found] <mailman.112.1068494680.2005.help-gnu-emacs@gnu.org>
@ 2003-11-10 23:08 ` Kevin Rodgers
2003-11-11 16:30 ` ERDI Gergo
2003-12-07 17:01 ` Kai Grossjohann
1 sibling, 1 reply; 5+ messages in thread
From: Kevin Rodgers @ 2003-11-10 23:08 UTC (permalink / raw)
ERDI Gergo wrote:
> So, who's inserting all those '$'s and how do I get rid of it?
Did you follow the instructions in the Interactive Customization section
of the CC Mode manual?
--
Kevin Rodgers
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: cc-mode: Reverting to the 'dumber' indentation of nested function calls, as seen in Emacs20
2003-11-10 23:08 ` Kevin Rodgers
@ 2003-11-11 16:30 ` ERDI Gergo
0 siblings, 0 replies; 5+ messages in thread
From: ERDI Gergo @ 2003-11-11 16:30 UTC (permalink / raw)
On Mon, 10 Nov 2003, Kevin Rodgers wrote:
> ERDI Gergo wrote:
>
> > So, who's inserting all those '$'s and how do I get rid of it?
>
> Did you follow the instructions in the Interactive Customization section
> of the CC Mode manual?
Yes, but like I said, I still have no idea where the 'smart' indentation
comes from. C-c C-s in the second line tells me it's in arglist-intro, but
the value of arglist-intro only determines the '#' in the above example,
and not the '$' part.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: cc-mode: Reverting to the 'dumber' indentation of nested function calls, as seen in Emacs20
2003-11-10 19:00 cc-mode: Reverting to the 'dumber' indentation of nested function calls, as seen in Emacs20 ERDI Gergo
@ 2003-11-13 19:33 ` ERDI Gergo
0 siblings, 0 replies; 5+ messages in thread
From: ERDI Gergo @ 2003-11-13 19:33 UTC (permalink / raw)
On Mon, 10 Nov 2003, ERDI Gergo wrote:
> [Please CC replies to cactus@cactus.rulez.org]
> However, with Emacs21, here's what I get (again, '#' denotes double-spaces
> from c-basic-offset. '$' denotes spaces inserted by an unknown smart
> offset-calculator that I wasn't able to hunt down)
1 > ##long_function_name (bar (
2 > $$$$$$$$$$$$$$$$$$$$$$##baz (0)));
so I dug into the sources and the documentation and here's what I got:
the $ part comes from the column 'bar' starts in, in the following way:
when line 2 is inspected, the syntactic analysis returns the position of
the 'b' of 'bar' in line 1. The indentation engine then takes the column
number of that position and uses it as the basis when calculating the
start of line 2.
So what actually happens here is that Emacs20's cc-mode engine got the
start of the expression wrong since it found the beginning 'l' of line 1
to be the start of the expression containing the "baz" call.
However, even now that I know what happens, I still don't know what I
can do about this. I'd still like to make this a special case and make the
indentation of arguments of nested function calls start from the outmost
function call and not the innermost.
Can anyone help me now that we have that more information?
Thanks,
Gergo
--
.--= ULLA! =---------------------. `We are not here to give users what
\ http://cactus.rulez.org \ they want' -- RMS, at GUADEC 2001
`---= cactus@cactus.rulez.org =---'
Jesus saves, Allah protects, and Buddha enlightens. Cthulhu thinks you taste good with ketchup.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: cc-mode: Reverting to the 'dumber' indentation of nested function calls, as seen in Emacs20
[not found] <mailman.112.1068494680.2005.help-gnu-emacs@gnu.org>
2003-11-10 23:08 ` Kevin Rodgers
@ 2003-12-07 17:01 ` Kai Grossjohann
1 sibling, 0 replies; 5+ messages in thread
From: Kai Grossjohann @ 2003-12-07 17:01 UTC (permalink / raw)
ERDI Gergo <cactus@cactus.rulez.org> writes:
> However, with Emacs21, here's what I get (again, '#' denotes double-spaces
> from c-basic-offset. '$' denotes spaces inserted by an unknown smart
> offset-calculator that I wasn't able to hunt down)
I *think* that the smartness is called lineup or line-up in CC mode.
It means that function args align under the opening parenthesis:
foo(a,
b);
foo1(a,
b);
foobar(a,
b);
Is this what you mean?
Kai
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2003-12-07 17:01 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-11-10 19:00 cc-mode: Reverting to the 'dumber' indentation of nested function calls, as seen in Emacs20 ERDI Gergo
2003-11-13 19:33 ` ERDI Gergo
[not found] <mailman.112.1068494680.2005.help-gnu-emacs@gnu.org>
2003-11-10 23:08 ` Kevin Rodgers
2003-11-11 16:30 ` ERDI Gergo
2003-12-07 17:01 ` Kai Grossjohann
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.