help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: indenting for managed c++


From: Alan Mackenzie
Subject: Re: indenting for managed c++
Date: Wed, 12 Oct 2005 08:29:14 +0000
User-agent: tin/1.4.5-20010409 ("One More Nightmare") (UNIX) (Linux/2.0.35 (i686))

Yogesh.Sajanikar@bentley.com wrote on Tue, 11 Oct 2005 10:01:42 +0200:

> Can anybody tell me how to indent managed c++ code (.NET 2003)
> correctly. The access specifiers are incorrectly classified as
> inher-cont.  For example, look at the following code,

> public class C :                // ((inher-cont 19))
>         private A              =20
>     {
>     private public:             // ((inher-cont 134))
>     };

What is the "public" on the first line for?  Is "Managed C++" a
non-standard extension of C++?

Supporting this properly would mean extending the indentation engine in
CC Mode.  If you want to try this, the function is `c-guess-basic-syntax'
in the file cc-engine.el.  Fair warning: this isn't something for the
faint-hearted.  ;-)

Alternatively, you could write a line-up function for inher-cont which
would recognise that the line is really a topmost-intro (or whatever),
and then call c-indent-line, giving this tweaked syntactic context as a
parameter:  Something like this:

You take the "((inher-cont 19))", change it to "((topmost-intro 19))",
then call "(c-indent-line '((topmost-intro 19)))".

I know, it's not very satisfactory.  But it's possible.

> Regards,
> ~Yogesh

-- 
Alan Mackenzie (Munich, Germany)
Email: aacm@muuc.dee; to decode, wherever there is a repeated letter
(like "aa"), remove half of them (leaving, say, "a").



reply via email to

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