本文介绍了将emacs ruby​​-mode缩进更改为4个空格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从上一篇文章我得到了Ruby模式在emacs中工作。这是非常好的





我们公司使用4个空格缩进,而不是默认值2.我无法使此工作。



这是我的.emacs文件

有没有人看到我做错了什么?



谢谢!

解决方案

tab-width 仅控制制表符的宽度,即在缓冲区中显示时,Tab字符等于多少空格。它不影响用于缩进代码的空格(或制表符)数量。



对于Ruby代码,缩进由 ruby​​控制-intent-level 变量:

 (setq ruby​​-indent-level 4)


From a previous post I got Ruby mode working in emacs. This is working great.

Setting up .emacs file for mac ruby development

Our company uses 4 spaces for indents though instead of the default 2. I am having difficulty getting this to work.

Here is my .emacs file

Does anyone see what I am doing wrong?

Thanks!

解决方案

The tab-width setting only controls the width of a tab character, i.e. how many spaces a tab character is equivalent to when displayed in your buffer. It does not affect the number of spaces (or tabs) used for indenting your code.

For Ruby code, the indentation is controlled by the ruby-indent-level variable:

(setq ruby-indent-level 4)

这篇关于将emacs ruby​​-mode缩进更改为4个空格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-18 09:19