* C++-mode, wrong indentation
@ 2008-07-02 4:59 Kevin Yu
2008-07-02 9:57 ` Alan Mackenzie
2010-02-04 21:24 ` Alan Mackenzie
0 siblings, 2 replies; 4+ messages in thread
From: Kevin Yu @ 2008-07-02 4:59 UTC (permalink / raw
To: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 390 bytes --]
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.
Best regards
Thanks.
[-- Attachment #2: Type: text/html, Size: 632 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: C++-mode, wrong indentation
2008-07-02 4:59 C++-mode, wrong indentation Kevin Yu
@ 2008-07-02 9:57 ` Alan Mackenzie
2008-07-14 13:44 ` Alan Mackenzie
2010-02-04 21:24 ` Alan Mackenzie
1 sibling, 1 reply; 4+ messages in thread
From: Alan Mackenzie @ 2008-07-02 9:57 UTC (permalink / raw
To: Kevin Yu; +Cc: bug-cc-mode, emacs-devel
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).
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: C++-mode, wrong indentation
2008-07-02 9:57 ` Alan Mackenzie
@ 2008-07-14 13:44 ` Alan Mackenzie
0 siblings, 0 replies; 4+ messages in thread
From: Alan Mackenzie @ 2008-07-14 13:44 UTC (permalink / raw
To: Kevin Yu; +Cc: bug-cc-mode, emacs-devel
Hello again, Kevin!
On Wed, Jul 02, 2008 at 09:57:31AM +0000, Alan Mackenzie wrote:
> 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.
[ .... ]
> I can probably fix this quite easily.
Correction: I can probably fix this. ;-( It's a bit trickier than I
thought it would be. I'm working on it.
--
Alan Mackenzie (Nuremberg, Germany).
-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: C++-mode, wrong indentation
2008-07-02 4:59 C++-mode, wrong indentation Kevin Yu
2008-07-02 9:57 ` Alan Mackenzie
@ 2010-02-04 21:24 ` Alan Mackenzie
1 sibling, 0 replies; 4+ messages in thread
From: Alan Mackenzie @ 2010-02-04 21:24 UTC (permalink / raw
To: Kevin Yu; +Cc: bug-cc-mode, emacs-devel
Hi, Keven,
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.
I've just committed a fix to this into the Emacs bzr repository. Also
into the CC Mode cvs repository at SourceForge. Don't tell me you forgot
about this? ;-)
> Best regards
> Thanks.
Sincerely,
--
Alan Mackenzie (Nuremberg, Germany).
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-02-04 21:24 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-02 4:59 C++-mode, wrong indentation Kevin Yu
2008-07-02 9:57 ` Alan Mackenzie
2008-07-14 13:44 ` Alan Mackenzie
2010-02-04 21:24 ` Alan Mackenzie
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.