Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ruby-mode not honoring deep paren option. #5322

Closed
askreet opened this issue Mar 1, 2016 · 12 comments
Closed

ruby-mode not honoring deep paren option. #5322

askreet opened this issue Mar 1, 2016 · 12 comments

Comments

@askreet
Copy link

askreet commented Mar 1, 2016

I'm having the same issue as described here:
http://stackoverflow.com/questions/2776317/like-vim-emacs-ruby-indentation

Setting ruby-use-smie to nil with defvar has no effect on whether or not this configuration option works. I'm using Spacemacs v0.105 on Emacs 24.5.1 (OS X).

@StreakyCobra
Copy link
Contributor

Have you tried to put this:

(setq ruby-deep-indent-paren nil)

in dotspacemacs/user-config of your .spacemacs?

@askreet
Copy link
Author

askreet commented Mar 2, 2016

@StreakyCobra I don't have a dotspacemacs/user-config, I have only dotspacemacs/config -- is my .spacemacs outdated?

I'll try adding it to dotspacemacs/config.

@askreet
Copy link
Author

askreet commented Mar 2, 2016

That did not work.

@StreakyCobra
Copy link
Contributor

is my .spacemacs outdated?

Slightly, you guessed it 😉 SPC f e D is helpful to keep it up to date :-)

That did not work.

Ok, I don't know then, I'm not doing ruby stuff at all.

@StreakyCobra
Copy link
Contributor

Have you tried to unset both in user-config, this seems to be needed:

 (setq ruby-deep-indent-paren nil)
 (setq ruby-use-smie nil)

And restarted Spacemacs?

@askreet
Copy link
Author

askreet commented Mar 2, 2016

@StreakyCobra Okay, now we're getting somewhere! It's not quite right, but I'm going to see if I can figure it out by using user-config.

@askreet
Copy link
Author

askreet commented Mar 2, 2016

Well, I now feel like ruby-mode is working-as-advertised and I just don't like it.

What I get:

method_call({
    stuff: {
      things: 'hi'
    }
  })

What I want:

method_call({
  stuff: {
    things: 'hi'
  }
})

Reading the indentation code in ruby-mode is challenging, but I'll try to see if I can make my own custom function.

@askreet
Copy link
Author

askreet commented Mar 2, 2016

Switching to the enh-ruby-mode option for the ruby layer fixed this issue. In the past, it had issues replaying vim macros. Wish me luck...

@askreet askreet closed this as completed Mar 2, 2016
@ankitrg
Copy link

ankitrg commented Aug 23, 2017

Did you make this work?

@vpokrityuk
Copy link

@StreakyCobra Thank you so much. Spent almost an hour googling trying to fix ruby indentation. Luckily saw your post mentioning "(setq ruby-use-smie nil)" that did help!

@asok
Copy link
Contributor

asok commented Jan 3, 2019

It seems that this answers this https://stackoverflow.com/a/20733875/710003
(setq ruby-align-to-stmt-keywords '(if begin case def)). Maybe it should be added to the ruby layer?

@yurighensev
Copy link

yurighensev commented Mar 4, 2021

Summing it up from previous answers:

(setq
  ruby-align-to-stmt-keywords '(if def begin case) ; set fixed indentation for these statements
  ruby-deep-indent-paren nil                       ; set fixed indentation for arguments inside parenthesis
  ruby-use-smie nil                                ; set fixed indentation for chained method calls
  )

Version tested with: 0.300.0@28.0.50, develop branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants