|
From: | Noah Peart |
Subject: | bug#67357: [PATCH] Fix c-ts-mode block indent when first-siblings are comments |
Date: | Fri, 24 Nov 2023 06:45:24 -0800 |
> I'm sorry I insist on a complete recipe with all the detailsOk, lemme try again :)To reproduce the indentation bugs for unbracketed `else_clause`, anddo-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 bufferYou should see that the line with comment `1` has not beenindented, and the line with comment `2` has been indented to thesame level as the previous line.To reproduce the indentation bugs when comments are the firstsiblings: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 bufferYou should see that the lines with comments `1` and `2` havenot 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.
[Prev in Thread] | Current Thread | [Next in Thread] |