[英]Emacs ruby-mode indent private
Does anyone know how to get ruby-mode in Emacs to indent all definitions under private? 有谁知道如何在Emacs中获取ruby-mode来缩进私有下的所有定义? 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. Private不会引入新范围,因此在其下缩进定义在技术上并不正确。 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).
虽然私有/受保护成员有几种缩进样式 ,但ruby-mode支持的唯一样式是语义正确的(不引入额外的嵌套)。 The "Ruby style guide" also recommends that style (not to mention a two 2 space indentation).
“Ruby样式指南”也推荐了样式(更不用说两个2空格缩进)。
That all being said - there's no way to customize this aspect of ruby-mode
. 这一切都说 - 没有办法自定义
ruby-mode
这个方面。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.