all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dgutov@yandex.ru>
To: Aaron Jensen <aaronjensen@gmail.com>, 61822@debbugs.gnu.org
Subject: bug#61822: 29.0.60; Ruby indentation with assignment and method calls
Date: Mon, 27 Feb 2023 00:18:22 +0200	[thread overview]
Message-ID: <1ec48204-0650-23f7-0d36-8ac7bdae2718@yandex.ru> (raw)
In-Reply-To: <m2r0ucfesf.fsf@gmail.com>

Hi!

On 26/02/2023 20:43, Aaron Jensen wrote:
> 
> I don't recall if this was a case we talked about, but this does not
> indent as I would expect/hope with ruby-mode and this set:
> 
> (setq ruby-block-indent nil
>        ruby-method-call-indent nil
>        ruby-method-params-indent nil
>        ruby-after-operator-indent nil)
> 
> Actual:
> 
> some_variable = some_method(
>      some_argument
>    )
> 
> Expected:
> 
> some_variable = some_method(
>    some_argument
> )

Somehow, we've never tested this one. On the higher level, it might 
actually be consistent, similar to the following:

   foo + bar(
       asdasd
     )

So the fix would depend on how you want them to behave.

Does the patch below work okay for you?

BTW, ruby-ts-mode handles these cases well already, I think.

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))






  reply	other threads:[~2023-02-26 22:18 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 [this message]
2023-02-26 22:57   ` Aaron Jensen
2023-02-26 23:57     ` Dmitry Gutov
2023-02-26 23:59       ` Aaron Jensen
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

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

  git send-email \
    --in-reply-to=1ec48204-0650-23f7-0d36-8ac7bdae2718@yandex.ru \
    --to=dgutov@yandex.ru \
    --cc=61822@debbugs.gnu.org \
    --cc=aaronjensen@gmail.com \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.