* bug#61871: 29.0.60; ruby-mode indentation with destructuring assignment
@ 2023-02-28 16:17 Aaron Jensen
2023-02-28 18:37 ` Dmitry Gutov
0 siblings, 1 reply; 4+ messages in thread
From: Aaron Jensen @ 2023-02-28 16:17 UTC (permalink / raw)
To: 61871
I found another edge case:
foo, bar = baz.(
some_arg
)
Should indent to:
foo, bar = baz.(
some_arg
)
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#61871: 29.0.60; ruby-mode indentation with destructuring assignment
2023-02-28 16:17 bug#61871: 29.0.60; ruby-mode indentation with destructuring assignment Aaron Jensen
@ 2023-02-28 18:37 ` Dmitry Gutov
2023-02-28 20:00 ` Aaron Jensen
0 siblings, 1 reply; 4+ messages in thread
From: Dmitry Gutov @ 2023-02-28 18:37 UTC (permalink / raw)
To: Aaron Jensen, 61871
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* bug#61871: 29.0.60; ruby-mode indentation with destructuring assignment
2023-02-28 18:37 ` Dmitry Gutov
@ 2023-02-28 20:00 ` Aaron Jensen
2023-02-28 21:01 ` Dmitry Gutov
0 siblings, 1 reply; 4+ messages in thread
From: Aaron Jensen @ 2023-02-28 20:00 UTC (permalink / raw)
To: Dmitry Gutov; +Cc: 61871
On Tue, Feb 28, 2023 at 1:37 PM Dmitry Gutov <dgutov@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
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#61871: 29.0.60; ruby-mode indentation with destructuring assignment
2023-02-28 20:00 ` Aaron Jensen
@ 2023-02-28 21:01 ` Dmitry Gutov
0 siblings, 0 replies; 4+ messages in thread
From: Dmitry Gutov @ 2023-02-28 21:01 UTC (permalink / raw)
To: Aaron Jensen; +Cc: 61871-done
Version: 29.1
On 28/02/2023 22:00, Aaron Jensen wrote:
> On Tue, Feb 28, 2023 at 1:37 PM Dmitry Gutov<dgutov@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.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-02-28 21:01 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-28 16:17 bug#61871: 29.0.60; ruby-mode indentation with destructuring assignment Aaron Jensen
2023-02-28 18:37 ` Dmitry Gutov
2023-02-28 20:00 ` Aaron Jensen
2023-02-28 21:01 ` Dmitry Gutov
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.