如何打开的括号在Emacs之后控制缩进 [英] How to control indentation after an open parenthesis in Emacs
问题描述
当我使用emacs的python模式,如果某行的最后一个字符是一个开放的括号它缩进的下一行只需一个步骤从previous线的压痕。
When I use emacs python-mode, if the last character of a line is an open parenthesis it indents the next line just one step in from the indentation of the previous line.
call_some_function(
some_very_long_argument_that_I_want_to_put_on_its_own_line)
我喜欢这样。现在,在ECMAScript的模式(这我使用的ActionScript 3的),它总是缩进到previous括号的水平。
I like that. Now in ecmascript-mode (which I am using for actionscript 3), it always indents to the level of the previous parenthesis.
call_some_function(
this_is_not_really_saving_me_any_horizontal_space);
我
如何使ECMAScript的模式缩进Python等模式在这方面?
How can I make ecmascript-mode indent like python-mode in this respect?
推荐答案
由于 ECMAScript的模式是基于CC-模式下,你可以使用 C-设置偏移
,它允许您自定义任何语法符号的偏移与preferred值。
Since ecmascript-mode is based on cc-mode, you can use c-set-offset
which allows you to customize any syntactic symbol's offset with the preferred value.
在你的情况,去哪个缩进在错误的层面来看,按抄送有限公司
(或键入的Mx C-设置偏移
),接受建议的符号(参数列表的-介绍
),并将它设置一个新的值(如 +
,默认的偏移量)。
In your case, go to the point which is indented in the wrong level, hit C-c C-o
(or type M-x c-set-offset
), accept the suggested symbol (arglist-intro
), and set it a new value (e.g. +
, the default offset).
您也可以做到这一点编程在dotemacs,比如,用:
You can also do it programmatically in your dotemacs, for instance, with:
(add-hook 'ecmascript-mode-hook
(lambda ()
(c-set-offset 'arglist-intro '+)
(c-set-offset 'arglist-close 0)))
这篇关于如何打开的括号在Emacs之后控制缩进的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!