GNU bug report logs -
#61871
29.0.60; ruby-mode indentation with destructuring assignment
Previous Next
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.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 61871 in the body.
You can then email your comments to 61871 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#61871
; Package
emacs
.
(Tue, 28 Feb 2023 16:18:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Aaron Jensen <aaronjensen <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Tue, 28 Feb 2023 16:18:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
I found another edge case:
foo, bar = baz.(
some_arg
)
Should indent to:
foo, bar = baz.(
some_arg
)
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#61871
; Package
emacs
.
(Tue, 28 Feb 2023 18:38:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 61871 <at> debbugs.gnu.org (full text, mbox):
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
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#61871
; Package
emacs
.
(Tue, 28 Feb 2023 20:01:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 61871 <at> debbugs.gnu.org (full text, mbox):
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.
Aaron
Reply sent
to
Dmitry Gutov <dgutov <at> yandex.ru>
:
You have taken responsibility.
(Tue, 28 Feb 2023 21:03:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Aaron Jensen <aaronjensen <at> gmail.com>
:
bug acknowledged by developer.
(Tue, 28 Feb 2023 21:03:02 GMT)
Full text and
rfc822 format available.
Message #16 received at 61871-done <at> debbugs.gnu.org (full text, mbox):
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.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Wed, 29 Mar 2023 11:24:08 GMT)
Full text and
rfc822 format available.
This bug report was last modified 2 years and 45 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.