From: Eli Zaretskii <eliz@gnu.org>
To: Jeff Norden <norden.jeff@gmail.com>
Cc: 64133@debbugs.gnu.org
Subject: bug#64133: CC Mode 5.35.2 (C/*l); incorrect indentation for an arrays of structs.
Date: Sat, 17 Jun 2023 18:14:34 +0300 [thread overview]
Message-ID: <831qiaqfxh.fsf@gnu.org> (raw)
In-Reply-To: <CAPbFCnkeeJLBa_EvUaGs1uGxkUjnxJBNdAbOhKNLYEtPaO+hKw@mail.gmail.com> (message from Jeff Norden on Sat, 17 Jun 2023 10:03:24 -0500)
> From: Jeff Norden <norden.jeff@gmail.com>
> Date: Sat, 17 Jun 2023 10:03:24 -0500
>
> I've verified the following behavior with c-version 5.35.2 (emacs-29,
> and emacs-30 from git) and with 5.35.1 (emacs 28.2).
>
> Place the following text into a file with a ".c" extension, and load
> it with "emacs -Q".
> ==========================================
> #include <stdio.h>
> struct three_ints {
> int a, b, c;
> };
> int main () {
> struct three_ints numbers[]= {
> {0,1,2},
> {3,4,5},
> {6,7,8}
> };
> for (int i=0; i<numbers[2].a; i++) {
> printf("ack ");
> }
> printf("\n");
> }
> ==========================================
> Move the cursor to the beginning of the line with {3,4,5} and press
> <tab> to indent the line. It will be incorrectly indented 2 spaces
> more than the previous line. Move to the next line, press <tab>,
> and you'll see:
>
> struct three_ints numbers[]= {
> {0,1,2},
> {3,4,5},
> {6,7,8}
> };
This source code uses the 'linux' indentation style, so you should do
M-x c-set-style RET linux RET
after which the problem goes away, AFAICT.
next prev parent reply other threads:[~2023-06-17 15:14 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-17 15:03 bug#64133: CC Mode 5.35.2 (C/*l); incorrect indentation for an arrays of structs Jeff Norden
2023-06-17 15:14 ` Eli Zaretskii [this message]
[not found] ` <CAPbFCnniiTyPQBmayZpRwS46--JW6ipmmLAzMterB5cK9NEXCA@mail.gmail.com>
2023-06-17 16:27 ` Eli Zaretskii
2023-06-17 17:36 ` Jeff Norden
2023-06-18 13:13 ` Alan Mackenzie
2023-06-18 16:10 ` Jeff Norden
2023-06-18 17:23 ` Jeff Norden
2023-06-19 11:46 ` Alan Mackenzie
2023-06-19 14:30 ` Jeff Norden
2023-06-21 10:39 ` Alan Mackenzie
2023-06-21 18:43 ` Jeff Norden
2023-06-27 20:19 ` 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=831qiaqfxh.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=64133@debbugs.gnu.org \
--cc=norden.jeff@gmail.com \
/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.