From: Eli Zaretskii <eliz@gnu.org>
To: Noah Peart <noah.v.peart@gmail.com>, Yuan Fu <casouri@gmail.com>
Cc: 67357@debbugs.gnu.org
Subject: bug#67357: [PATCH] Fix c-ts-mode block indent when first-siblings are comments
Date: Thu, 23 Nov 2023 09:35:13 +0200 [thread overview]
Message-ID: <834jhchqha.fsf@gnu.org> (raw)
In-Reply-To: <CAPVBTSeWonc5P_0a1W90e2TUaCMO_H-Y_7SZDiWFt+=PkmPLEA@mail.gmail.com> (message from Noah Peart on Tue, 21 Nov 2023 17:50:52 -0800)
> From: Noah Peart <noah.v.peart@gmail.com>
> Date: Tue, 21 Nov 2023 17:50:52 -0800
>
> I wasn't sure if these should be two separate bugs, so I separated them just
> in case.
>
> * lisp/progmodes/c-ts-mode.el(c-ts-mode--indent-styles): Fix indentation
> in block statements for cases when the first-sibling(s) are comments or
> nested keywords (else_clause/do while).
>
> Bug: The first statement in a compound statement that is preceded by a
> comment (or multiple comments) isn't indented.
>
> For example, the `if` statement isnt indented in the following code in
> `c-ts-mode` using `linux` style.
>
> int main() {
> while (true) { /* foo */
> if (true) { // this line isnt indented
> puts ("Hello"); // and this isnt either
> }
> }
> }
>
> * lisp/progmodes/c-ts-mode.el(c-ts-mode--indent-styles): Fix indentation
> for else_clause and do-while in bracket-less block statements using
> `linux` style.
>
> Bug: There is no matching indent rule for bracket-less else_clause
> statements and the "while" in a bracket-less do-while statement is
> indented to the same level as the do body.
>
> To reproduce, using `linux` style in `c-ts-mode`.
>
> int main() {
> if (true)
> puts("Hello");
> else
> puts("No matched rule!");
> do
> puts("Hello");
> while (indented_as_part_of_block);
> }
I'm not sure I can reproduce these, it seems to me that the
indentation is correct in these case when I try the examples. So
please show a detailed recipe, starting from "emacs -Q", for each of
the two problems, so that we could be sure that we are seeing the same
problems.
Also, please tell if the same problems exist on the emacs-29 branch.
Adding Yuan to the discussion.
next prev parent reply other threads:[~2023-11-23 7:35 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-22 1:50 bug#67357: [PATCH] Fix c-ts-mode block indent when first-siblings are comments Noah Peart
2023-11-23 7:35 ` Eli Zaretskii [this message]
2023-11-23 13:17 ` Dmitry Gutov
2023-11-23 14:33 ` Eli Zaretskii
2023-11-23 14:41 ` Dmitry Gutov
2023-11-24 13:47 ` Noah Peart
2023-11-24 14:07 ` Eli Zaretskii
2023-11-24 14:35 ` Noah Peart
2023-11-24 14:45 ` Noah Peart
2023-11-24 14:46 ` Eli Zaretskii
2023-11-29 13:47 ` Eli Zaretskii
2023-12-09 8:23 ` Eli Zaretskii
2023-12-10 9:09 ` Yuan Fu
2023-12-10 9:39 ` Eli Zaretskii
2023-12-11 1:11 ` Yuan Fu
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=834jhchqha.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=67357@debbugs.gnu.org \
--cc=casouri@gmail.com \
--cc=noah.v.peart@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.