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

From: Dmitry Gutov <[email-masked]>
Date: Thu, 19 Oct 2023 23:05:54 +0300

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.