[英]How do I keep braces from moving in Emacs cperl mode?
I'm using GNU Emacs 22.2.1 and cperl 5.23. 我正在使用GNU Emacs 22.2.1和cperl 5.23。
I have perl code like this: 我有这样的Perl代码:
sub foo
{
if($x)
{
print "x";
}
else
{
print "y";
}
}
I'd like to reindent the code to a 2-space indent. 我想将代码重新缩进2位缩进。 But when I run
cperl-indent-region
on this code, I get: 但是,当我在此代码上运行
cperl-indent-region
时,我得到:
sub foo
{
if ($x) {
print "x";
} else {
print "y";
}
}
I believe the customization you're looking for is: 我相信您要寻找的定制是:
(setq cperl-extra-newline-before-brace t
cperl-brace-offset -2
cperl-merge-trailing-else nil)
You can customize cperl mode with Mx customize-group <ENTER> cperl <ENTER>
. 您可以使用
Mx customize-group <ENTER> cperl <ENTER>
custom Mx customize-group <ENTER> cperl <ENTER>
定义cperl模式。 The indentation variables are in the Cperl Indentation Details subgroup. 缩进变量位于“ Cperl缩进详细信息”子组中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.