GNU bug report logs - #16182
24.3.50; ruby-mode: Indentation style of multiline literals with hanging open paren inside other parens

Previous Next

Package: emacs;

Reported by: Dmitry Gutov <dgutov <at> yandex.ru>

Date: Wed, 18 Dec 2013 03:56:02 UTC

Severity: minor

Found in version 24.3.50

Done: Dmitry Gutov <dgutov <at> yandex.ru>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Bozhidar Batsov <bozhidar <at> batsov.com>
To: 16182 <at> debbugs.gnu.org, Gutov Dmitry <dgutov <at> yandex.ru>
Cc: Steve Purcell <steve <at> sanityinc.com>, Adam Sokolnicki <adam.sokolnicki <at> gmail.com>
Subject: bug#16182: Acknowledgement (24.3.50; ruby-mode: Indentation style of multiline literals with hanging open paren inside other parens)
Date: Thu, 19 Dec 2013 14:54:56 +0200
[Message part 1 (text/plain, inline)]
I can confirm that your method args indentation fix is working. I did, however, notice the following problem after I mentioned the if/unless/case with assignment indentation. Consider the following:

res = method do |x, y|
  something
end


Might make sense to indent those like:

res = method do |x, y|
           something
         end


for consistency with the if/unless/case indentation by default. Also:

res =
  method do |x, y|
    something
  end


is actually indented like this:

res =
  method do |x, y|
  something
end


--  
Cheers,
Bozhidar


On Thursday, December 19, 2013 at 11:08 AM, Bozhidar Batsov wrote:

> On Thursday, December 19, 2013 at 6:35 AM, Dmitry Gutov wrote:
> > Bozhidar Batsov <bozhidar <at> batsov.com (mailto:bozhidar <at> batsov.com)> writes:
> >  
> > > Personally I dislike this style, because you’re basically it obscures
> > > the semantics of the method arguments, but I acknowledge that I’ve
> > > seen it the wild.
> > >  
> >  
> >  
> > Ok, that's a -1, then.
> >  
> > > For me it would be more beneficial if we supported a
> > > variant of the style:
> > >  
> > > methods.each do |method|
> > > route_set.add_route(
> > > self, {
> > > path_info: route.route_compiled,
> > > request_method: method,
> > > }, route_info: route
> > > )
> > > end
> > >  
> >  
> >  
> > Should work now, with revision 115602.
> >  
> > > Something that’s not mentioned here, but it’s a bigger problem for the
> > > users is probably the fact that we don’t support the following
> > > indentation style:
> > >  
> > > x = if something
> > > do_something
> > > end
> > >  
> > > Even if I don’t use and (and the majority of Ruby hackers AFAIK) it’s
> > > still fairly popular.
> > >  
> >  
> >  
> > It's actually easy to do now, but the old engine doesn't support that
> > either. That should be takes as evidence that Emacs Rubyists don't care
> > about this variant much (I didn't see it in feature requests either).
> >  
> > So I'd rather wait for a request from someone who actually would use it.
> > If you'd like to add it now, please propose the name of the user option.
> >  
> >  
> >  
>  
> I recall seeing StackOverflow questions about this in Emacs, but as I neither practice nor promote this style I’m indifferent to supporting it in Emacs. I do, however, support it in RuboCop (https://github.com/bbatsov/rubocop/issues/661). If we decide to have it in Emacs we might use a similar name for the config variable - `ruby-end-alignment’ with two options - ‘keword and ‘assignment.   
>  

[Message part 2 (text/html, inline)]

This bug report was last modified 11 years and 247 days ago.

Previous Next


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