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

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

bug#60186: 29.0.60; ruby-mode indentation of multi-line expressions


From: Dmitry Gutov
Subject: bug#60186: 29.0.60; ruby-mode indentation of multi-line expressions
Date: Wed, 28 Dec 2022 14:47:12 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2

On 28/12/2022 05:47, Aaron Jensen wrote:
On Tue, Dec 27, 2022 at 8:02 PM Dmitry Gutov <dgutov@yandex.ru> wrote:

On 28/12/2022 02:38, Aaron Jensen wrote:

Or here's a step back: looking at how the two other user options I named
previously were ruby-method-params-indent and ruby-block-indent, the
latest might as well be called ruby-operator-indent, or
ruby-operator-indent and ruby-method-call-indent.

I wasn't too crazy about those names originally, but the approach is
very extensible with styles by adding new symbols as possible values.

This may end up being the right direction. If the values are symbols
you can use things that are relative to one another like "simple".
There could be a benefit to all of these having a "simple" option.
What would it mean if it were nil?
What's the current behavior called?

For the sake of uniformity, I wanted to start with simple values -- t
and nil, and explain their meanings in the docstring.

't' would mean the current behavior, and I'd call it "structural", or
structure-based indentation. Or based on implicit expression grouping.

I'd typically not use t and nil on anything but a boolean and the name
would be named after what t represents, but this may be an Emacs idiom
that is OK. If so, and there's no better options (i.e., going against
that idiom is worse than not), then that works for me.

I guess that particular trend started with ruby-method-params-indent, where I haven't managed to choose better names for the var, or the values.

It may be that if we only intend to support two indentation schemes we
just have default and simplified as you suggested and then we can use
boolean values. I don't know how Emacs-like this is, but what if there
were one variable like `ruby-indent-simple` that could either be `t`
or a list of things to indent simply?

That can work too, but what is "simple"? ;-)

Further, I'm not sure if we're going to get more than 2 "things" this
way (operators and method calls). OTOH, if we have a separate var for
operators -- ruby-operator-indent -- we could enumerate which operators
to indent "structurally" after. Or something like that.

Not sure which direction the feature requests will drive this extension
toward, though. Maybe mostly nowhere, given the previous history. But
Rubocop's example seems to indicate that there are many different styles
out there.

Yeah, hard to say, and it may eventually become less important if
ruby-ts comes about and has enough options to satisfy folks with
different ideas about indentation.

ruby-ts-mode might have extra flexibility down the line, but at the start I want to have it obey the same indentation options as ruby-mode.

BTW, you can check out its progress at https://github.com/pedz/ruby-ts-mode/.





reply via email to

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