开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜