GNU bug report logs - #32496
27.0.50; Strange indentation when ruby-align-chained-calls is t

Previous Next

Package: emacs;

Reported by: bruce.connor.am <at> gmail.com

Date: Wed, 22 Aug 2018 11:37:01 UTC

Severity: minor

Found in version 27.0.50

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: bruce.connor.am <at> gmail.com, 32496 <at> debbugs.gnu.org
Subject: bug#32496: 27.0.50; Strange indentation when ruby-align-chained-calls is t
Date: Wed, 22 Aug 2018 15:50:05 +0300
On 8/22/18 2:36 PM, Artur Malabarba wrote:
> 1. (setq ruby-align-chained-calls t)
> 2. (setq ruby-use-smie t)
> 3. Open a file in ruby-mode, insert the following and indent it
> 
> ----------
> some_variable.where.not(x: nil)
>               .where(y: 2)
> ----------
> 
> Expected behaviour: Nothing would happen, the code is already properly
> indented.
> 
> What actually happens: The code gets indented as follows
> 
> ----------
> some_variable.where.not(x: nil)
>                     .where(y: 2)
> ----------
> 
> Note that this is conflicts with the indentation enforced by rubocop.

I'd like to point out that this is exactly the behavior Bozhidar asked 
for, back when this variable was introduced. See:

http://lists.gnu.org/archive/html/emacs-devel/2014-01/msg01802.html

and in particular the Example 1 in the referenced comment:

https://github.com/rubocop-hq/ruby-style-guide/pull/176#issuecomment-18664622

So we even have a test (ruby-align-chained-calls) that check that the 
alignment is do to the last dot, and not to the first one.




This bug report was last modified 3 years and 314 days ago.

Previous Next


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