bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#64589: 30.0.50; smie-config-guess can break ruby indentation


From: Aaron Jensen
Subject: bug#64589: 30.0.50; smie-config-guess can break ruby indentation
Date: Thu, 19 Oct 2023 17:41:19 -0400

On Thu, Oct 19, 2023 at 4:05 PM Dmitry Gutov <dmitry@gutov.dev> wrote:
>
> Hi Aaron,
>
> On 13/07/2023 07:20, Aaron Jensen wrote:
> > In repro.rb:
> >
> > def some_method
> >    return some_other_method(
> >      some_argument
> >    )
> > end
> >
> > emacs -Q repro.rb
> > M-x smie-config-guess
> >
> > Type:
> >
> > foo(
> > x
> > )
> >
> > The x will not be indented. If smie-config-guess is omitted, it indents
> > as expected.
>
> Sorry about the late reply.
>
> But it seems like this feature might be incompatible with the relatively
> complex way the ruby-mode indentation is written (the comments inside
> 'smie-config--guess' seem to indicate so). So while it does sound cool
> to be able to use style detection, it might only work okay for certain
> languages/indentation rules.
>
> One thing to note, though, is that it seems to want larger files, to be
> able to "learn" from more cases. But when I provide a larger file, it
> usually ends up saying "Nothing to change", even if some lines are
> indented differently from the current config. E.g. if I just expand your
> example to:
>
>    def some_method
>      return some_other_method(
>        some_argument
>      )
>
>      foo(
>        bar,
>        tee
>      )
>    end
>
> then adding foo(<RET> at the end indents predictably okay.
>
> Perhaps Stefan as the author could tell us whether it's at all feasible
> to adjust ruby-mode to be more compatible with smie-config-guesser, or
> whether there could be some low-hanging fruit in the latter to help.

Ok, thanks. The context here is that I use dtrt-indent and it invokes
this before doing its work. For now, I have disabled it in Ruby (which
I think is actually fine because I thankfully don't work with any Ruby
code that is something other than 2 spaces).

So right now, I'm not concerned about this personally, but it does
seem odd that it breaks indentation in some cases.

Thanks,

Aaron





reply via email to

[Prev in Thread] Current Thread [Next in Thread]