GNU bug report logs - #61871
29.0.60; ruby-mode indentation with destructuring assignment

Previous Next

Package: emacs;

Reported by: Aaron Jensen <aaronjensen <at> gmail.com>

Date: Tue, 28 Feb 2023 16:18:01 UTC

Severity: normal

Found in version 29.0.60

Fixed in version 29.1

Done: Dmitry Gutov <dgutov <at> yandex.ru>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Aaron Jensen <aaronjensen <at> gmail.com>
Subject: bug#61871: closed (Re: bug#61871: 29.0.60; ruby-mode indentation
 with destructuring assignment)
Date: Tue, 28 Feb 2023 21:03:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#61871: 29.0.60; ruby-mode indentation with destructuring assignment

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 61871 <at> debbugs.gnu.org.

-- 
61871: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=61871
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Aaron Jensen <aaronjensen <at> gmail.com>
Cc: 61871-done <at> debbugs.gnu.org
Subject: Re: bug#61871: 29.0.60; ruby-mode indentation with destructuring
 assignment
Date: Tue, 28 Feb 2023 23:01:57 +0200
Version: 29.1

On 28/02/2023 22:00, Aaron Jensen wrote:
> On Tue, Feb 28, 2023 at 1:37 PM Dmitry Gutov<dgutov <at> yandex.ru>  wrote:
>> Hi!
>>
>> On 28/02/2023 18:17, Aaron Jensen wrote:
>>> I found another edge case:
>>>
>>> foo, bar = baz.(
>>>          some_arg
>>>        )
>>>
>>> Should indent to:
>>>
>>> foo, bar = baz.(
>>>     some_arg
>>> )
>> Thanks for that. This one is caused by implicit syntax which it
>> non-trivial for SMIE to handle. ruby-ts-mode, predictably, indents it fine.
>>
>> Please try this patch out:
>>
>> diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el
>> index 559b62fef54..beccb8182a7 100644
>> --- a/lisp/progmodes/ruby-mode.el
>> +++ b/lisp/progmodes/ruby-mode.el
>> @@ -916,11 +916,14 @@ ruby-smie-rules
>>                (smie-indent--hanging-p))
>>           ruby-indent-level)))
>>        (`(:before . "=")
>> -     (save-excursion
>> -      (and (smie-rule-parent-p " @ ")
>> -           (goto-char (nth 1 (smie-indent--parent)))
>> -           (smie-rule-prev-p "def=")
>> -           (cons 'column (+ (current-column) ruby-indent-level -3)))))
>> +     (or
>> +      (save-excursion
>> +        (and (smie-rule-parent-p " @ ")
>> +             (goto-char (nth 1 (smie-indent--parent)))
>> +             (smie-rule-prev-p "def=")
>> +             (cons 'column (+ (current-column) ruby-indent-level -3))))
>> +      (and (smie-rule-parent-p ",")
>> +           (smie-rule-parent))))
>>        (`(:after . ,(or "?" ":"))
>>         (if ruby-after-operator-indent
>>             ruby-indent-level
> This works for me for this case, thank you.

Thanks for checking! Closing.

[Message part 3 (message/rfc822, inline)]
From: Aaron Jensen <aaronjensen <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 29.0.60; ruby-mode indentation with destructuring assignment
Date: Tue, 28 Feb 2023 11:17:27 -0500
I found another edge case:

foo, bar = baz.(
       some_arg
     )

Should indent to:

foo, bar = baz.(
  some_arg
)



This bug report was last modified 2 years and 86 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.