Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Emacs ruby-mode indent private

Does anyone know how to get ruby-mode in Emacs to indent all definitions under private? Here's an example:

def redirect_back_or(default)    
    redirect_to(session[:return_to] || default)    
    clear_return_to  
end 

private

    def user_from_remember_token      
        User.authenticate_with_salt(*remember_token)    
    end
like image 872
stackOverlord Avatar asked Nov 13 '22 15:11

stackOverlord


1 Answers

Private doesn't introduce a new scope, so indenting definitions under it is not technically correct. While there are several indentation styles for private/protected members, the only one supported by ruby-mode is the one that is semantically correct (doesn't introduce additional nesting). The "Ruby style guide" also recommends that style (not to mention a two 2 space indentation).

That all being said - there's no way to customize this aspect of ruby-mode.

like image 139
Bozhidar Batsov Avatar answered Dec 20 '22 03:12

Bozhidar Batsov