emacs-devel
[Top][All Lists]
Advanced

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

Re: C++-mode, wrong indentation


From: Alan Mackenzie
Subject: Re: C++-mode, wrong indentation
Date: Wed, 2 Jul 2008 09:57:31 +0000
User-agent: Mutt/1.5.9i

Hi, Kevin!

On Wed, Jul 02, 2008 at 12:59:36PM +0800, Kevin Yu wrote:
> Hi,

> ====code====
> if (x < 0 || y < 0 || x >= 9) {
>                        // c++-mode will indent this line with
> 2*c-basic-offset when editing.
>             } // and this line with c-basic-offset
> ====code====

> If you copy the above code into a c++-mode buffer, the indentation is
> right.  But when you reenter the ">=" of first line, the indentation
> goes wrong again.

Yes.  This is a bug.

If you're interested in what's happening, (you don't have to be ;-):

#########################################################################
The problem is to do with CC Mode's suboptimal handling of templates in
C++ Mode and Java Mode.

If you delete the ">=", then type just the ">" (as a first step towards
typing ">="), CC Mode spuriously recognises the "<..>" pair as template
brackets.  You can see this with show-paren-mode, or C-M-p.

When you then type the "=", it leaves the "<" as a bracket, but not the
">".  This messes up the paren matching, and causes mis-analysis of the
following lines of code.
#########################################################################

I can probably fix this quite easily.

Many thanks for a crisp, high quality bug report!

> Best regards
>    Thanks.

-- 
Alan Mackenzie (Nuremberg, Germany).




reply via email to

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