From: Dmitry Gutov <dgutov@yandex.ru>
To: Aaron Jensen <aaronjensen@gmail.com>, 54702@debbugs.gnu.org
Subject: bug#54702: 29.0.50; ruby-mode indentation: endless methods
Date: Wed, 27 Apr 2022 05:44:36 +0300 [thread overview]
Message-ID: <2136fe2e-85dd-8a3f-dc7b-ee7a8389dc76@yandex.ru> (raw)
In-Reply-To: <m2y20lppu8.fsf@gmail.com>
Hi Aaron,
On 04.04.2022 05:03, Aaron Jensen wrote:
>
> Ruby 3 and 3.1 bring us different versions of endless methods. They
> currently don't indent correctly in `ruby-mode`:
>
> Current:
>
> ```rb
> class Bar
> def foo = bar
>
> def baz
> end
> end
> ```
>
> Expected:
>
> ```rb
> class Bar
> def foo = bar
>
> def baz
> end
> end
> ```
Thanks for the report.
I'll work on this further, but here's a quick-and-dirty patch to fix the
indentation problems.
diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el
index a197724634..3733603fb3 100644
--- a/lisp/progmodes/ruby-mode.el
+++ b/lisp/progmodes/ruby-mode.el
@@ -528,6 +528,9 @@ ruby-smie--forward-token
(ruby-smie--forward-token)) ;Fully redundant.
(t ";")))
((equal tok "&.") ".")
+ ((and (equal tok "def")
+ (looking-at " *[a-zA-Z0-9_]* *\\(([^()]*)\\)? *="))
+ "def=")
(t tok)))))))))
(defun ruby-smie--backward-token ()
@@ -575,6 +578,9 @@ ruby-smie--backward-token
(ruby-smie--backward-token)) ;Fully redundant.
(t ";")))
((equal tok "&.") ".")
+ ((and (equal tok "def")
+ (looking-at "def *[a-zA-Z0-9_]* *\\(([^()]*)\\)? *="))
+ "def=")
(t tok)))))))
(defun ruby-smie--indent-to-stmt ()
next prev parent reply other threads:[~2022-04-27 2:44 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-04 2:03 bug#54702: 29.0.50; ruby-mode indentation: endless methods Aaron Jensen
2022-04-27 2:44 ` Dmitry Gutov [this message]
2022-04-27 23:58 ` Aaron Jensen
2022-12-16 0:33 ` Dmitry Gutov
2022-12-16 5:07 ` Aaron Jensen
2022-12-16 12:31 ` Dmitry Gutov
2022-12-16 12:40 ` Dmitry Gutov
2022-12-16 14:49 ` Eli Zaretskii
2022-12-18 12:06 ` Dmitry Gutov
2022-12-18 15:42 ` Aaron Jensen
2022-12-16 13:12 ` Aaron Jensen
2022-12-16 16:15 ` Dmitry Gutov
2022-12-16 16:24 ` Aaron Jensen
2022-12-16 17:49 ` 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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2136fe2e-85dd-8a3f-dc7b-ee7a8389dc76@yandex.ru \
--to=dgutov@yandex.ru \
--cc=54702@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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).