简体   繁体   中英

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

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM