From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Aaron Jensen Newsgroups: gmane.emacs.bugs Subject: bug#60186: 29.0.60; ruby-mode indentation of multi-line expressions Date: Thu, 22 Dec 2022 23:12:53 -0500 Message-ID: References: <4e44df18-207c-c7ca-0588-7285f3008dfb@yandex.ru> <358bbd65-9375-04c8-f0a2-24a4383f142e@yandex.ru> <2b4a91e1-bad1-382f-dd64-abf171efb404@yandex.ru> <60e207e0-7378-ad9f-3ef0-99df1c139939@yandex.ru> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14046"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 60186@debbugs.gnu.org To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Dec 23 05:14:11 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p8ZRi-0003Qv-Oe for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 23 Dec 2022 05:14:10 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p8ZRb-0000TG-Tr; Thu, 22 Dec 2022 23:14:03 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p8ZRa-0000T8-St for bug-gnu-emacs@gnu.org; Thu, 22 Dec 2022 23:14:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p8ZRa-0005aZ-CO for bug-gnu-emacs@gnu.org; Thu, 22 Dec 2022 23:14:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p8ZRZ-0001vR-VW for bug-gnu-emacs@gnu.org; Thu, 22 Dec 2022 23:14:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Aaron Jensen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 23 Dec 2022 04:14:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60186 X-GNU-PR-Package: emacs Original-Received: via spool by 60186-submit@debbugs.gnu.org id=B60186.16717687937379 (code B ref 60186); Fri, 23 Dec 2022 04:14:01 +0000 Original-Received: (at 60186) by debbugs.gnu.org; 23 Dec 2022 04:13:13 +0000 Original-Received: from localhost ([127.0.0.1]:36550 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p8ZQm-0001ux-Tc for submit@debbugs.gnu.org; Thu, 22 Dec 2022 23:13:13 -0500 Original-Received: from mail-pf1-f177.google.com ([209.85.210.177]:39574) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p8ZQl-0001uq-0N for 60186@debbugs.gnu.org; Thu, 22 Dec 2022 23:13:11 -0500 Original-Received: by mail-pf1-f177.google.com with SMTP id w26so2558694pfj.6 for <60186@debbugs.gnu.org>; Thu, 22 Dec 2022 20:13:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=cyYklORKF5GPn1j2xRMYyp/6C1v/cTZz4rFmEpkcZp8=; b=IeCq2Azgg1pF5mBGPD3WuK6qX1J8XBAZAnkERjC/7dHZoX4n/dMvZA6U9liVeWzTTq U0oAvBEoGQ66FjI9RxXfyAQIlCM6J0USCtOTlnO+HoARQxqlMy9G7D6ih+4YDrxMD5ci 2a2T4jU9mSTVyKtDuYVnfmf0Q5uZ0PwPwpM1Yh+2Jpf0eorQwRLvk6lWs5cZfgMVzvrM jqwtIA65gOho+1CmOaQcp3FJhZktx5ubJoAAR24ExQyLK9GS+3EY+BntTC3JjE0HmD1m yDBokGYQmiaEkPVeS/V2m0TFmw1BxVOnpBGgJts8cl5F3UeLIKDxF/2iqix99/QIPWea m0SQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=cyYklORKF5GPn1j2xRMYyp/6C1v/cTZz4rFmEpkcZp8=; b=KhXpqsExfvxmQXYvHCXyzHvQlVrGJYxEp3P81ZCjUSs0EWHwL7DJ2mUYQ3zPrIqlqZ ihhwK30Gn3wR/kYvL0te0GmYHDlbXrGj8gzz7V83fHicMW1UgimfyFYRL5mGKshwQn1S V5nP8/H5O+UTq6hzhGH4kVwo4XyCHGhIW3TtUvmaepS0xiiEOAW9HqsMOrHQYp8f25H+ c/XgFPVvAYiBMQPikjiD84QDn8gdAOdlr+BDQAZBDs4Ot4tnbFsvefBWdiNJhM+ikAbW N78+ORwpQolX3gwfx7wFO3bNXYiohCSnAzp5DiyIOTwLI/ZqWGYLqqyX9N555nIs87MP hn8w== X-Gm-Message-State: AFqh2kok0TvgmOcDDfcnqSXX+SOTLdAJ1ZROnPOKxf/Gfv5vfC0u1klQ jzRAALcqiWgXttSJOkNw2PXnl2yM031Q+83JU2w= X-Google-Smtp-Source: AMrXdXu8u+WZZpu29nEMNvOgQTETFBx7oYZJNr3D0J2U8rE61Llk8XcFbmKr3xsrQmE91Z5fojJZgmlFtL2O/D4+qd8= X-Received: by 2002:a63:4d12:0:b0:478:a6de:4d1b with SMTP id a18-20020a634d12000000b00478a6de4d1bmr358111pgb.95.1671768784663; Thu, 22 Dec 2022 20:13:04 -0800 (PST) In-Reply-To: <60e207e0-7378-ad9f-3ef0-99df1c139939@yandex.ru> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:251697 Archived-At: On Thu, Dec 22, 2022 at 4:21 PM Dmitry Gutov wrote: > > On 22/12/2022 04:31, Aaron Jensen wrote: > > On Wed, Dec 21, 2022 at 5:48 PM Dmitry Gutov wrote: > >> See this new patch instead. > >> > >> The code is messier than I'd like it to be, but it seems to handle all > >> of the cases mentioned so far and more (including the > >> dots-at-indentation style, thanks). > > > > Looks good, for the things I mentioned. I found one more case: > > > > x.foo do > > foo > > end.bar do > > bar > > end > > > > Should be: > > > > x.foo do > > foo > > end.bar do > > bar > > end > > Hm, this one breaks the approach I used with the last patch (which was > to count lines from the beginning of the statement). > > Let's see if blocks can just be aligned to the indentation of its > opener's line. > > > I can't vouch for writing in this style, but it should only get one > > indentation increase in this instance, rather than, I believe. > > > > Interestingly enough, I found a bug with enh-ruby-mode that ruby-mode > > now indents correctly: > > > > x = > > bar( > > y > > ).map do |i| > > i > > end > > Cool. It seems I broke it for the default indent algo, however. ;-( In > the previous patch. > > See the new one attached. Seems to work well with everything I threw at it. > BTW, I'm surprised you haven't mentioned the case of parenless calls: > > foo bar, > baz, > tee > > IUUC the Rails core has decided to forgo this indentation style. Not > sure about the statistics across other popular projects. I try to avoid this style in general. The simplified style with the 2 spaces means the first argument is on a different plane than the rest which negatively impacts scanning. With either indentation style, the first argument (which is the most significant one when a method is properly designed) will have the least presence when scanning. It's just not a good format in my experience. In our code we take it a step further and always use parentheses except for in class level "macros". This means that any time we decide to split a method invocation on multiple lines we use the basic newline after ( style. Aaron