all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: gnu-emacs-bug@moderators.isc.org
Subject: bug#17756: indentation after declaring+initializing two arrays
Date: Thu, 12 Jun 2014 19:25:47 +0000 (UTC)	[thread overview]
Message-ID: <lncurr$108d$1__7406.6970883452$1402601772$gmane$org@colin.muc.de> (raw)
In-Reply-To: <CAA1=4djKnQnJr4OGi8sz5tBduT97OCF_CvOdH0VVcVPbTo4Htg@mail.gmail.com>

Pietro Belotti <petr.7b6@gmail.com> wrote:
> Hello. I have a problem with Emacs (version: 23.4.1
> (x86_64-pc-linux-gnu, GTK+ Version 2.24.10) of 2012-09-08 on trouble,
> modified by Debian [2 times]). A declaration is incorrectly indented
> when following one where two or more arrays are declared and
> initialized. The function foo() below has "char c = 'a';"
> over-indented, while the function bar() following it has the same
> declaration correctly indented.

> int foo () {
>
>  int a [2] = {1,2},
>    b [2] = {3,4};
>
>    char c = 'a';
> }

> This also happens if a newline is placed between "int" and "a [2]",
> but it does not happen if a and b are declared on the same line. Both
> M-x indent-region and moving the cursor and hitting TAB result in
> this. I could not find any related issue in the mailing list archive,
> is this expected behaviour?

No, it's a bug.  What is happening is that C Mode has got confused by the
brace expression "{1,2}" into thinking that a statement ends after
"{1,2},", because close braces are usually ends of statements.  Hence it
thinks that "b [2] ...." is the beginning of a statement.  The next
statement "char c ..." is thus indented under the "b [2] ...".

I'll get a fix to this out soon.  Thanks for taking the trouble to report
this bug.

By the way, for future reference, it is helpful if you say what major mode
you're using (the best place being in the Subject:) so that we don't have
to guess.

> Thanks,
> Pietro

-- 
Alan Mackenzie (Nuremberg, Germany).






  reply	other threads:[~2014-06-12 19:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.3424.1402501025.1147.bug-gnu-emacs@gnu.org>
2014-06-11 14:26 ` bug#17756: indentation after declaring+initializing two arrays Pietro Belotti
2014-06-12 19:25   ` Alan Mackenzie [this message]
     [not found] ` <lncurr$108d$1@colin.muc.de>
2014-06-16 21:31   ` Alan Mackenzie
2014-08-02 20:49     ` Alan Mackenzie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='lncurr$108d$1__7406.6970883452$1402601772$gmane$org@colin.muc.de' \
    --to=acm@muc.de \
    --cc=gnu-emacs-bug@moderators.isc.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.