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

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

bug#61822: closed (29.0.60; Ruby indentation with assignment and method


From: GNU bug Tracking System
Subject: bug#61822: closed (29.0.60; Ruby indentation with assignment and method calls)
Date: Mon, 27 Feb 2023 00:12:04 +0000

Your message dated Mon, 27 Feb 2023 02:10:55 +0200
with message-id <d20991b7-1a65-cb28-db59-fba6f5ac33c0@yandex.ru>
and subject line Re: bug#61822: 29.0.60; Ruby indentation with assignment and 
method calls
has caused the debbugs.gnu.org bug report #61822,
regarding 29.0.60; Ruby indentation with assignment and method calls
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs@gnu.org.)


-- 
61822: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=61822
GNU Bug Tracking System
Contact help-debbugs@gnu.org with problems
--- Begin Message --- Subject: 29.0.60; Ruby indentation with assignment and method calls Date: Sun, 26 Feb 2023 13:43:44 -0500
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
)



--- End Message ---
--- Begin Message --- Subject: Re: bug#61822: 29.0.60; Ruby indentation with assignment and method calls Date: Mon, 27 Feb 2023 02:10:55 +0200 User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1
On 27/02/2023 01:59, Aaron Jensen wrote:
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.

Thanks for testing, pushed to emacs-29.


--- End Message ---

reply via email to

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