GNU bug report logs - #2141
C mode indentation problem

Previous Next

Packages: cc-mode, emacs;

Reported by: Reuben Thomas <rrt <at> sc3d.org>

Date: Sun, 1 Feb 2009 19:45:02 UTC

Severity: normal

Done: Alan Mackenzie <acm <at> muc.de>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 2141 in the body.
You can then email your comments to 2141 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#2141; Package emacs. (Sun, 01 Feb 2009 19:45:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Reuben Thomas <rrt <at> sc3d.org>:
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Sun, 01 Feb 2009 19:45:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Reuben Thomas <rrt <at> sc3d.org>
To: bug-emacs <at> gnu.org
Subject: C mode indentation problem
Date: Sun, 1 Feb 2009 19:38:54 +0000 (GMT)
Running Emacs from CVS head as "./emacs -Q foo.c" to create a new buffer 
foo.c in C mode, if I enter the following text, indenting as I go:

----cut here----
int main (void)
{
  int foo;

  switch (foo)
    {
    case BLAH | 'a':
      bar = 0;
    break;
---cut here----

it is indented as above, which I believe is wrong, as the "break" should be 
indented to the same column as the previous line. If I change the case line 
to simply "case BLAH:" then this does indeed happen.

-- 
http://rrt.sc3d.org/ | That's about as useful as a paper wok





Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#2141; Package emacs. (Sun, 01 Feb 2009 21:10:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Alan Mackenzie <acm <at> muc.de>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Sun, 01 Feb 2009 21:10:03 GMT) Full text and rfc822 format available.

Message #10 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Alan Mackenzie <acm <at> muc.de>
To: Reuben Thomas <rrt <at> sc3d.org>, 2141 <at> debbugs.gnu.org
Cc: bug-emacs <at> gnu.org, bug-cc-mode <at> gnu.org
Subject: Re: bug#2141: C mode indentation problem
Date: Sun, 1 Feb 2009 21:23:42 +0000
Hi, Reuben,

On Sun, Feb 01, 2009 at 07:38:54PM +0000, Reuben Thomas wrote:
> Running Emacs from CVS head as "./emacs -Q foo.c" to create a new buffer 
> foo.c in C mode, if I enter the following text, indenting as I go:

> ----cut here----
> int main (void)
> {
>   int foo;
> 
>   switch (foo)
>     {
>     case BLAH | 'a':
>       bar = 0;
>     break;
> ---cut here----

> it is indented as above, which I believe is wrong, as the "break" should be 
> indented to the same column as the previous line. If I change the case line 
> to simply "case BLAH:" then this does indeed happen.

This is indeed a bug.  I'm looking into it now.

Thanks for reporting it!

-- 
Alan Mackenzie (Nuremberg, Germany).





Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#2141; Package emacs. (Sun, 01 Feb 2009 21:10:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to Alan Mackenzie <acm <at> muc.de>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Sun, 01 Feb 2009 21:10:05 GMT) Full text and rfc822 format available.

bug reassigned from package `emacs' to `emacs,cc-mode'. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> emacsbugs.donarmstrong.com. (Mon, 02 Feb 2009 07:20:04 GMT) Full text and rfc822 format available.

Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>, owner <at> emacsbugs.donarmstrong.com:
bug#2141; Package emacs,cc-mode. (Sat, 21 Feb 2009 16:20:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Alan Mackenzie <acm <at> muc.de>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>, owner <at> emacsbugs.donarmstrong.com. (Sat, 21 Feb 2009 16:20:04 GMT) Full text and rfc822 format available.

Message #22 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Alan Mackenzie <acm <at> muc.de>
To: Reuben Thomas <rrt <at> sc3d.org>, 2141 <at> debbugs.gnu.org
Cc: bug-emacs <at> gnu.org
Subject: Re: bug#2141: C mode indentation problem
Date: Sat, 21 Feb 2009 16:35:17 +0000
Hi, Reuben!

On Sun, Feb 01, 2009 at 07:38:54PM +0000, Reuben Thomas wrote:
> Running Emacs from CVS head as "./emacs -Q foo.c" to create a new
> buffer foo.c in C mode, if I enter the following text, indenting as I
> go:

> ----cut here----
> int main (void)
> {
>   int foo;
> 
>   switch (foo)
>     {
>     case BLAH | 'a':
>       bar = 0;
>     break;
> ---cut here----

> it is indented as above, which I believe is wrong, as the "break"
> should be indented to the same column as the previous line. If I change
> the case line to simply "case BLAH:" then this does indeed happen.

It should be fixed now in the CVS at savannah.

CC Mode was lacking code to parse (compile-time) expressions as case
labels.

-- 
Alan Mackenzie (Nuremberg, Germany).





Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>, owner <at> emacsbugs.donarmstrong.com:
bug#2141; Package emacs,cc-mode. (Sat, 21 Feb 2009 16:20:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to Alan Mackenzie <acm <at> muc.de>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>, owner <at> emacsbugs.donarmstrong.com. (Sat, 21 Feb 2009 16:20:05 GMT) Full text and rfc822 format available.

Reply sent to Alan Mackenzie <acm <at> muc.de>:
You have taken responsibility. (Sat, 21 Feb 2009 16:30:03 GMT) Full text and rfc822 format available.

Notification sent to Reuben Thomas <rrt <at> sc3d.org>:
bug acknowledged by developer. (Sat, 21 Feb 2009 16:30:04 GMT) Full text and rfc822 format available.

Message #32 received at 2141-done <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Alan Mackenzie <acm <at> muc.de>
To: 2141-done <at> debbugs.gnu.org
Subject: Re: bug#2141: C mode indentation problem
Date: Sat, 21 Feb 2009 16:44:48 +0000
On Sun, Feb 01, 2009 at 07:38:54PM +0000, Reuben Thomas wrote:
> Running Emacs from CVS head as "./emacs -Q foo.c" to create a new buffer 
> foo.c in C mode, if I enter the following text, indenting as I go:

> ----cut here----
> int main (void)
> {
>   int foo;

>   switch (foo)
>     {
>     case BLAH | 'a':
>       bar = 0;
>     break;
> ---cut here----

> it is indented as above, which I believe is wrong, as the "break" should be 
> indented to the same column as the previous line. If I change the case line 
> to simply "case BLAH:" then this does indeed happen.

Fixed by enhancing c-beginning-of-statement-1 to handle (compile-time)
expressions as case labels.

-- 
Alan Mackenzie (Nuremberg, Germany).




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> emacsbugs.donarmstrong.com. (Sun, 22 Mar 2009 14:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 16 years and 177 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.