From: Noah Peart <noah.v.peart@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: dmitry@gutov.dev, casouri@gmail.com, 67357@debbugs.gnu.org
Subject: bug#67357: [PATCH] Fix c-ts-mode block indent when first-siblings are comments
Date: Fri, 24 Nov 2023 06:35:06 -0800 [thread overview]
Message-ID: <CAPVBTSduP1onTVZ-_V8gF=h+dnrn+5on3HbD_BQTS-Rf6h5LeQ@mail.gmail.com> (raw)
In-Reply-To: <8334wvfdna.fsf@gnu.org>
[-- Attachment #1: Type: text/plain, Size: 2122 bytes --]
> I'm sorry I insist on a complete recipe with all the details
Ok, lemme try again :)
To reproduce the indentation bugs for unbracketed `else_clause`, and
do-while:
1. open a buffer and insert the following:
int main() {
if (true)
puts("Hello");
else
puts("No matched rule!"); // 1
do
puts("Hello");
while (indented_as_part_of_block); // 2
}
2. call `M-x example-setup` to configure `c-ts-mode`
3. `M-x indent-region` to indent the whole buffer
You should see that the line with comment `1` has not been
indented, and the line with comment `2` has been indented to the
same level as the previous line.
To reproduce the indentation bugs when comments are the first
siblings:
1. open a buffer and insert:
int main() {
while (true) { /* foo */
if (true) { // 1
puts ("Hello"); // 2
}
}
}
2. call `M-x example-setup` to configure `c-ts-mode`
3. `M-x indent-region` to indent the whole buffer
You should see that the lines with comments `1` and `2` have
not been indented at all.
On Fri, Nov 24, 2023 at 6:07 AM Eli Zaretskii <eliz@gnu.org> wrote:
> > From: Noah Peart <noah.v.peart@gmail.com>
> > Date: Fri, 24 Nov 2023 05:47:34 -0800
> > Cc: Eli Zaretskii <eliz@gnu.org>, casouri@gmail.com,
> 67357@debbugs.gnu.org
> >
> > Sorry for the confusion: to setup the `c-ts-mode` buffers to reproduce
> bugs,
> > run the following to configure `c-ts-mode` with `linux` style:
> >
> > (defun example-setup ()
> > (interactive)
> > (c-ts-mode)
> > (setq-local indent-tabs-mode nil)
> > (setq-local c-ts-mode-indent-offset 2)
> > (c-ts-mode-set-style 'linux))
>
> Thanks, but what to do after (or before?) the above, to actually
> reproduce the problem?
>
> I'm sorry I insist on a complete recipe with all the details, but IME
> without having such a recipe, it is all too easy to create
> misunderstandings about the problem, and harder to test solutions.
>
[-- Attachment #2: Type: text/html, Size: 3180 bytes --]
next prev parent reply other threads:[~2023-11-24 14: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
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 [this message]
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAPVBTSduP1onTVZ-_V8gF=h+dnrn+5on3HbD_BQTS-Rf6h5LeQ@mail.gmail.com' \
--to=noah.v.peart@gmail.com \
--cc=67357@debbugs.gnu.org \
--cc=casouri@gmail.com \
--cc=dmitry@gutov.dev \
--cc=eliz@gnu.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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).