Emacs红宝石模式缩进定制的case..when和从if..else分配? [英] Emacs ruby-mode indenting customization for case..when and assignment from an if..else?

查看:156
本文介绍了Emacs红宝石模式缩进定制的case..when和从if..else分配?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Emacs中,使用红宝石模式,我找不到办法阻止这种情况发生:

In Emacs, using ruby-mode, I can't find a way to stop this happening:

foo = if something?
        42
      else
        7
      end

我们的内部公约是:

foo = if something?
  42
else
  7
end

begin..end case..when

此外,虽然不太麻烦,但是 case..when 的约定是缩小每个,当

Also, while it's less of a nuisance, our convention for case..when is to indent each when.

case whatever
  when foo
    "a"
  when bar
    "b"
  else
    "c"
end

我知道人们一般说你应该将案件一致,但这不是我们公司的惯例,有人也知道如何定制这个吗?我可以找到很少定制的红宝石模式。我唯一能够自定义的内容是括号内的缩进。

I know people generally say you should align the when with the case, but it's not the convention of our company, so does anybody know how to customize this too? I can find very little customization for ruby-mode. The only thing I've really been able to customize is the indentation inside parentheses.

推荐答案

没有办法自定义。红宝石模式是缩写定制的关键,Matz(其原作者)完全坚持支持缩进标准样式。

There is no way to customize this. ruby-mode is pretty barebone as far as indentation customizations are concerned and Matz (its original author) is totally adamant in supporting the standard style for case indentation.

这篇关于Emacs红宝石模式缩进定制的case..when和从if..else分配?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆