GNU bug report logs - #67357
[PATCH] Fix c-ts-mode block indent when first-siblings are comments

Previous Next

Package: emacs;

Reported by: Noah Peart <noah.v.peart <at> gmail.com>

Date: Wed, 22 Nov 2023 01:52:02 UTC

Severity: normal

Tags: patch

Done: Yuan Fu <casouri <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #20 received at 67357 <at> debbugs.gnu.org (full text, mbox):

From: Noah Peart <noah.v.peart <at> gmail.com>
To: Dmitry Gutov <dmitry <at> gutov.dev>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 67357 <at> debbugs.gnu.org, casouri <at> gmail.com
Subject: Re: bug#67357: [PATCH] Fix c-ts-mode block indent when first-siblings
 are comments
Date: Fri, 24 Nov 2023 05:47:34 -0800
[Message part 1 (text/plain, inline)]
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))

The patch should also fix the missing indent for the `else_clause`
mentioned
in https://lists.gnu.org/archive/html/bug-gnu-emacs/2023-11/msg01266.html.

On Thu, Nov 23, 2023 at 6:41 AM Dmitry Gutov <dmitry <at> gutov.dev> wrote:

> On 23/11/2023 16:33, Eli Zaretskii wrote:
> >> Date: Thu, 23 Nov 2023 15:17:40 +0200
> >> Cc: 67357 <at> debbugs.gnu.org
> >> From: Dmitry Gutov <dmitry <at> gutov.dev>
> >>
> >> On 23/11/2023 09:35, Eli Zaretskii wrote:
> >>> 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.
> >>
> >> I can easily reproduce the first one (comment-related): the two
> >> indicated lines just don't reindent at all. That's with the default
> >> 'gnu' indentation style, but also with 'linux' and perhaps others (I
> >> haven't tried).
> >
> > I don't understand what you mean by "reindent".  That wasn't what the
> > original report was about, AFAIU.
>
> Reindent is when you press tab, and the indentation on a given line
> changes. In that example, no matter which indentation you set on those
> line, pressing TAB doesn't change it.
>
> > I still think a complete recipe is needed.
> >
> >> To reproduce the second one, you first need to enable the 'linux' style:
> >
> > I tried to reproduce _only_ with the 'linux' style, as the bug report
> > said.
> >
> >>     (setq c-ts-mode-indent-style 'linux)
> >>     M-x c-ts-mode
> >
> > The style is a per-buffer setting, so AFAIU one needs to set the style
> > after turning on the mode in a buffer, whether manually or
> > automatically.
>
> Did you use 'M-x c-ts-mode-set-style', then? That also repros for me.
>
> The style can be set locally - as the above command does - but initially
> the global value is used. And it's applied during the major mode's
> execution, so a simple 'setq' doesn't work.
>
> > A full recipe is supposed to remove all those confusing details and
> > potential mistakes.
>
> I don't mind.
>
[Message part 2 (text/html, inline)]

This bug report was last modified 1 year and 196 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.