unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Aaron Jensen <aaronjensen@gmail.com>
To: Dmitry Gutov <dgutov@yandex.ru>
Cc: 61822@debbugs.gnu.org
Subject: bug#61822: 29.0.60; Ruby indentation with assignment and method calls
Date: Sun, 26 Feb 2023 18:59:37 -0500	[thread overview]
Message-ID: <CAHyO48z_Q1723hUfs44=K2k9g3U+Pi-XccddQiUauL727-c6Qw@mail.gmail.com> (raw)
In-Reply-To: <04f40592-80dd-ec66-a30a-c30e3fa5de81@yandex.ru>

On Sun, Feb 26, 2023 at 6:57 PM Dmitry Gutov <dgutov@yandex.ru> wrote:
>
> On 27/02/2023 00:57, Aaron Jensen wrote:
> >> diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el
> >> index dba9ff0a846..6778507bc2b 100644
> >> --- a/lisp/progmodes/ruby-mode.el
> >> +++ b/lisp/progmodes/ruby-mode.el
> >> @@ -908,7 +908,8 @@ ruby-smie-rules
> >>                         "+=" "-=" "*=" "/=" "%=" "**=" "&=" "|=" "^=" "|"
> >>                         "<<=" ">>=" "&&=" "||=" "and" "or"))
> >>         (cond
> >> -      ((not ruby-after-operator-indent)
> >> +      ((and (not ruby-after-operator-indent)
> >> +            (smie-indent--hanging-p))
> >>           (ruby-smie--indent-to-stmt ruby-indent-level))
> >>          ((and (smie-rule-parent-p ";" nil)
> >>                (smie-indent--hanging-p))
> >>
> > This seems to work for me. I'm good with this being the same too as it
> > is with your patch:
> >
> > foo + bar(
> >    asdasd
> > )
>
> Hmm, that one seems to misindent this example:
>
>    some_variable = abc + some_method(
>                      some_argument
>                    )
>
> How about this patch?
>
> diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el
> index dba9ff0a846..559b62fef54 100644
> --- a/lisp/progmodes/ruby-mode.el
> +++ b/lisp/progmodes/ruby-mode.el
> @@ -909,7 +909,9 @@ ruby-smie-rules
>                        "<<=" ">>=" "&&=" "||=" "and" "or"))
>        (cond
>         ((not ruby-after-operator-indent)
> -       (ruby-smie--indent-to-stmt ruby-indent-level))
> +       (ruby-smie--indent-to-stmt (if (smie-indent--hanging-p)
> +                                      ruby-indent-level
> +                                    0)))
>         ((and (smie-rule-parent-p ";" nil)
>               (smie-indent--hanging-p))
>          ruby-indent-level)))
>

Nice catch. This patch looks good to me.

Aaron





  reply	other threads:[~2023-02-26 23:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-26 18:43 bug#61822: 29.0.60; Ruby indentation with assignment and method calls Aaron Jensen
2023-02-26 22:18 ` Dmitry Gutov
2023-02-26 22:57   ` Aaron Jensen
2023-02-26 23:57     ` Dmitry Gutov
2023-02-26 23:59       ` Aaron Jensen [this message]
2023-02-27  0:10         ` Dmitry Gutov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAHyO48z_Q1723hUfs44=K2k9g3U+Pi-XccddQiUauL727-c6Qw@mail.gmail.com' \
    --to=aaronjensen@gmail.com \
    --cc=61822@debbugs.gnu.org \
    --cc=dgutov@yandex.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).